git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES/trunk@5 9a1d36f3-7752-2d40-8ccb-50eb49674c68
169 lines
6.1 KiB
ObjectPascal
169 lines
6.1 KiB
ObjectPascal
unit uEditorComisiones;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uEditorItem, JvAppStorage, JvAppRegistryStorage, JvComponent,
|
||
JvFormPlacement, ImgList, PngImageList, StdActns, ActnList, ComCtrls,
|
||
TBX, TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls,
|
||
JvNavigationPane, uEditorBase, uCustomView, uViewBase, StdCtrls,
|
||
uDADataTable, dxLayoutControl, cxContainer, cxEdit, cxTextEdit,
|
||
cxMaskEdit, cxDropDownEdit, cxCalendar, cxControls, dxLayoutLookAndFeels,
|
||
cxStyles, DB, cxGrid, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxGridCustomView,
|
||
cxCurrencyEdit, cxSpinEdit, uBizComisiones, cxCheckBox, cxSplitter,
|
||
JvComponentBase, JvExExtCtrls, JvSplitter, JvSplit, dxPSGlbl, dxPSUtl,
|
||
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
|
||
dxPSFillPatterns, dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGridLnk,
|
||
dxPSContainerLnk, dxPSdxLCLnk;
|
||
|
||
type
|
||
IEditorComisiones = interface(IEditorBase)
|
||
['{C3894FB2-9030-466C-B2D9-5CF3CF5EA1B8}']
|
||
end;
|
||
|
||
TfEditorComisiones = class(TfEditorBase, IEditorComisiones)
|
||
Button1: TButton;
|
||
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
||
dxLayoutControl1: TdxLayoutControl;
|
||
edtFechaIni: TcxDateEdit;
|
||
edtFechaFin: TcxDateEdit;
|
||
dxLayoutControl1Item2: TdxLayoutItem;
|
||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
|
||
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
|
||
DADataSource: TDADataSource;
|
||
dxLayoutControl1Item4: TdxLayoutItem;
|
||
cxGrid: TcxGrid;
|
||
cxGridView: TcxGridDBTableView;
|
||
cxGridViewVENDEDOR: TcxGridDBColumn;
|
||
cxGridViewPORCENTAJE: TcxGridDBColumn;
|
||
cxGridViewCOMISION: TcxGridDBColumn;
|
||
cxGridLevel: TcxGridLevel;
|
||
dxLayoutControl1Item1: TdxLayoutItem;
|
||
dxLayoutControl1Group2: TdxLayoutGroup;
|
||
dxLayoutControl1Item5: TdxLayoutItem;
|
||
edtImporteCobros: TcxCurrencyEdit;
|
||
dxLayoutControl1Item6: TdxLayoutItem;
|
||
dxLayoutControl1Group3: TdxLayoutGroup;
|
||
cxGrid1: TcxGrid;
|
||
cxGridDBTableView1: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
dxLayoutControl1Item3: TdxLayoutItem;
|
||
cxGridDBTableView1RecID: TcxGridDBColumn;
|
||
cxGridDBTableView1SELECCION: TcxGridDBColumn;
|
||
cxGridDBTableView1CODIGOEMPRESA: TcxGridDBColumn;
|
||
cxGridDBTableView1CODIGO: TcxGridDBColumn;
|
||
cxGridDBTableView1CODIGOCONTACTO: TcxGridDBColumn;
|
||
cxGridDBTableView1NOMBRE: TcxGridDBColumn;
|
||
cxGridDBTableView1FECHAPAGO: TcxGridDBColumn;
|
||
cxGridDBTableView1IMPORTE: TcxGridDBColumn;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyleEven: TcxStyle;
|
||
cxStyleOdd: TcxStyle;
|
||
cxStyleSelection: TcxStyle;
|
||
DADataSource2: TDADataSource;
|
||
cxSplitter1: TcxSplitter;
|
||
cxGridDBTableView1DESCRIPCION: TcxGridDBColumn;
|
||
dxComponentPrinter: TdxComponentPrinter;
|
||
dxComponentPrinterLink1: TdxGridReportLink;
|
||
dxComponentPrinterLink2: TdxCompositionReportLink;
|
||
dxComponentPrinterLink3: TdxGridReportLink;
|
||
dxComponentPrinterLink4: TdxLayoutControlReportLink;
|
||
dxComponentPrinterLink5: TdxCustomContainerReportLink;
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure edtFechaIniPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
procedure CustomEditorGetModified(Sender: TObject;
|
||
var Modified: Boolean);
|
||
procedure cxGridDBTableView1CustomDrawCell(
|
||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure actPrevisualizarExecute(Sender: TObject);
|
||
private
|
||
FComisiones : TDADataTable;
|
||
FCobrosComision : IBizCobrosComision;
|
||
procedure OnTotalChanged(Sender : TObject);
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
fEditorComisiones: TfEditorComisiones;
|
||
|
||
implementation
|
||
|
||
uses uDataModuleComisiones, DateUtils, FactuGES_Intf, schComisionesClient_Intf;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfEditorComisiones.Button1Click(Sender: TObject);
|
||
begin
|
||
//Liberamos
|
||
if Assigned(FCobrosComision) then
|
||
FCobrosComision := Nil;
|
||
|
||
FCobrosComision := dmComisiones.GetCobrosComision(edtFechaIni.Date, edtFechaFin.Date);
|
||
DADataSource.DataTable := FCobrosComision.DataTable;
|
||
DADataSource2.DataTable := FCobrosComision.VendedoresComision.DataTable;
|
||
FCobrosComision.OnTotalChanged := OnTotalChanged;
|
||
DADataSource2.DataTable.Active := True; //No cambiar el orden es importante que el orden sea este
|
||
DADataSource.DataTable.Active := True;
|
||
end;
|
||
|
||
procedure TfEditorComisiones.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
edtFechaIni.Date := DateOf(StartOfTheMonth(Now));
|
||
edtFechaFin.Date := DateOf(EndOfTheMonth(Now));
|
||
end;
|
||
|
||
procedure TfEditorComisiones.edtFechaIniPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
begin
|
||
inherited;
|
||
if Length(DisplayValue) = 0 then
|
||
begin
|
||
Error := True;
|
||
ErrorText := 'La fecha no puede ser vac<61>a';
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorComisiones.CustomEditorGetModified(Sender: TObject;
|
||
var Modified: Boolean);
|
||
begin
|
||
inherited;
|
||
Modified := False;
|
||
end;
|
||
|
||
procedure TfEditorComisiones.cxGridDBTableView1CustomDrawCell(
|
||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
IndiceCol : Integer;
|
||
begin
|
||
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_CobrosCOMISIONSELECCION).Index;
|
||
if UPPERCASE(AViewInfo.GridRecord.DisplayTexts[IndiceCol]) = 'FALSE' then
|
||
begin
|
||
ACanvas.Canvas.Font.Style := [fsStrikeOut];
|
||
ACanvas.Canvas.Font.Color := clGray;
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorComisiones.OnTotalChanged(Sender: TObject);
|
||
begin
|
||
edtImporteCobros.Value := FCobrosComision.Total;
|
||
end;
|
||
|
||
procedure TfEditorComisiones.actPrevisualizarExecute(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
dxComponentPrinter.Preview;
|
||
end;
|
||
|
||
end.
|