diff --git a/Build/Build.fbl6 b/Build/Build.fbl6 index a9036f4..5871df2 100644 Binary files a/Build/Build.fbl6 and b/Build/Build.fbl6 differ diff --git a/Build/Build.fbpInf b/Build/Build.fbpInf index 2813cbe..aaee386 100644 --- a/Build/Build.fbpInf +++ b/Build/Build.fbpInf @@ -1,6 +1,6 @@ - {0F75D8EA-B6C2-4ECA-9E1E-45E235135301},{10527A84-0FB7-4007-9B23-9E5826133948},{154CD4CE-0F61-40F6-8CE6-CF525D3CFDCA},{331AC851-CE2F-4986-9381-A257AB26B1AD},{3F8BEF26-5F4F-4B97-B1BC-118F36CBDD68},{4968AB21-B759-4F4A-9214-8792F67DA1E2},{4B038673-47F7-4436-BD07-D557FA62337E},{68D393D0-7234-4D5A-9D3A-A3FDC1593E55},{6C425F09-E04B-49EC-89E2-8C93D60E9055},{7251A871-CE6C-41D1-A404-735619825EAE},{789902B1-5E64-4FD9-80BF-6113B13BFE12},{856B4CEA-BF27-4696-8FFC-4507B6E29943},{A181C54F-9BE8-4404-9AB9-FEE8A9C3443D},{AD23CE23-8728-48FA-84FD-264E27BA8F46},{B70F0EA3-7874-42B0-BFB8-430D43AC2D61},{C662116C-EB3F-4161-A768-49D13B08EFE5},{CE990EA4-7660-4997-8CBF-6C6AA978753A},{E8E8671F-894B-4049-B4A6-905B57207637},{F2541E28-3C45-4A17-BEC5-185CBF9D2A90} + {0F75D8EA-B6C2-4ECA-9E1E-45E235135301},{10527A84-0FB7-4007-9B23-9E5826133948},{154CD4CE-0F61-40F6-8CE6-CF525D3CFDCA},{331AC851-CE2F-4986-9381-A257AB26B1AD},{3F8BEF26-5F4F-4B97-B1BC-118F36CBDD68},{4968AB21-B759-4F4A-9214-8792F67DA1E2},{4B038673-47F7-4436-BD07-D557FA62337E},{6C425F09-E04B-49EC-89E2-8C93D60E9055},{7251A871-CE6C-41D1-A404-735619825EAE},{789902B1-5E64-4FD9-80BF-6113B13BFE12},{856B4CEA-BF27-4696-8FFC-4507B6E29943},{A181C54F-9BE8-4404-9AB9-FEE8A9C3443D},{AD23CE23-8728-48FA-84FD-264E27BA8F46},{B70F0EA3-7874-42B0-BFB8-430D43AC2D61},{C662116C-EB3F-4161-A768-49D13B08EFE5},{CE990EA4-7660-4997-8CBF-6C6AA978753A},{E8E8671F-894B-4049-B4A6-905B57207637},{F2541E28-3C45-4A17-BEC5-185CBF9D2A90} @@ -14,8 +14,8 @@ - 00:04:03 - 02/12/2013 13:45:23 - True + 00:00:13 + 12/12/2013 10:39:51 + False diff --git a/Build/Build.fbz6 b/Build/Build.fbz6 index d82a694..9d01cdf 100644 Binary files a/Build/Build.fbz6 and b/Build/Build.fbz6 differ diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index 4abc4a4..545b3a9 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -45,8 +45,6 @@ Package FalseTrueFalseLibreria base de FactuGESFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0 - - Microsoft Office 2000 Sample Automation Server Wrapper Components Microsoft Office XP Sample Automation Server Wrapper Components Base.dpk @@ -56,58 +54,6 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DataModuleImpresiones
TDataModule @@ -116,6 +62,58 @@
DataModuleRegistroCorreos
TDataModule
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fConfigurarConexion
diff --git a/Source/Cliente/uBootStrap.pas b/Source/Cliente/uBootStrap.pas index 2080fa6..6ff6c6a 100644 --- a/Source/Cliente/uBootStrap.pas +++ b/Source/Cliente/uBootStrap.pas @@ -39,7 +39,7 @@ begin LoadModule('RecibosCliente_plugin.bpl'); LoadModule(MODULENAME_FACTURAS_CLIENTE); -// LoadModule(MODULENAME_FACTURAS_PROFORMA); + LoadModule(MODULENAME_FACTURAS_PROFORMA); LoadModule(MODULENAME_PEDIDOS_PROVEEDOR); LoadModule(MODULENAME_ALBARANES_PROVEEDOR); diff --git a/Source/Informes/1/InfFacturaProforma.fr3 b/Source/Informes/1/InfFacturaProforma.fr3 new file mode 100644 index 0000000..df99e7a --- /dev/null +++ b/Source/Informes/1/InfFacturaProforma.fr3 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Informes/2/InfFacturaProforma.fr3 b/Source/Informes/2/InfFacturaProforma.fr3 new file mode 100644 index 0000000..ae0b642 --- /dev/null +++ b/Source/Informes/2/InfFacturaProforma.fr3 @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Informes/5/InfFacturaProforma.fr3 b/Source/Informes/5/InfFacturaProforma.fr3 new file mode 100644 index 0000000..54badad --- /dev/null +++ b/Source/Informes/5/InfFacturaProforma.fr3 @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Informes/6/InfFacturaProforma.fr3 b/Source/Informes/6/InfFacturaProforma.fr3 new file mode 100644 index 0000000..b7758b9 --- /dev/null +++ b/Source/Informes/6/InfFacturaProforma.fr3 @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Informes/8/InfFacturaProforma.fr3 b/Source/Informes/8/InfFacturaProforma.fr3 new file mode 100644 index 0000000..1a11f7e --- /dev/null +++ b/Source/Informes/8/InfFacturaProforma.fr3 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Modulos/Contactos/Views/Contactos_view.res b/Source/Modulos/Contactos/Views/Contactos_view.res index 1641339..8b251f3 100644 Binary files a/Source/Modulos/Contactos/Views/Contactos_view.res and b/Source/Modulos/Contactos/Views/Contactos_view.res differ diff --git a/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.dfm b/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.dfm index 28422fa..22bc8a8 100644 --- a/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.dfm +++ b/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.dfm @@ -249,22 +249,32 @@ inherited DataModuleFacturasProforma: TDataModuleFacturasProforma DisplayLabel = 'FacturasProforma_DATOS_BANCARIOS' DictionaryEntry = 'FacturasProforma_DATOS_BANCARIOS' end - item - Name = 'REFERENCIA_CLIENTE' - DataType = datString - Size = 255 - end item Name = 'ID_PEDIDO' DataType = datInteger DisplayLabel = 'FacturasProforma_ID_PEDIDO' DictionaryEntry = 'FacturasProforma_ID_PEDIDO' end + item + Name = 'REFERENCIA_PEDIDO_CLIENTE' + DataType = datString + Size = 255 + end + item + Name = 'REFERENCIA_DEL_CLIENTE' + DataType = datString + Size = 255 + end item Name = 'ID_FACTURA_FINAL' DataType = datInteger DisplayLabel = 'FacturasProforma_ID_FACTURA_FINAL' DictionaryEntry = 'FacturasProforma_ID_FACTURA_FINAL' + end + item + Name = 'REFERENCIA_FACTURA_FINAL' + DataType = datString + Size = 255 end> Params = <> StreamingOptions = [soDisableEventsWhileStreaming] diff --git a/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.pas b/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.pas index dcf2fa2..25be025 100644 --- a/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.pas +++ b/Source/Modulos/Facturas proforma/Data/uDataModuleFacturasProforma.pas @@ -57,29 +57,25 @@ function TDataModuleFacturasProforma.GetRptFacturas(const AListaID: TIntegerList var AParam : TIntegerArray; begin -{ AParam := AListaID.ToIntegerArray; try - Result := (RORemoteService as IsrvFacturasCliente).GenerarInforme(AParam, VerSello, VerCopia); + Result := (RORemoteService as IsrvFacturasProforma).GenerarInforme(AParam); finally FreeANDNIL(AParam); end; -} end; function TDataModuleFacturasProforma.GetRptPDFFactura(const AID: Integer): Binary; var AParam : TIntegerArray; begin -{ AParam := TIntegerArray.Create; try AParam.Add(AID); - Result := (RORemoteService as IsrvFacturasCliente).GenerarInformeEnPDF(AParam, VerSello); + Result := (RORemoteService as IsrvFacturasProforma).GenerarInformeEnPDF(AParam); finally FreeANDNIL(AParam); end; -} end; function TDataModuleFacturasProforma.NewItem: IBizFacturaProforma; diff --git a/Source/Modulos/Facturas proforma/FacturasProforma_Group.groupproj b/Source/Modulos/Facturas proforma/FacturasProforma_Group.groupproj index 1a95fa9..fb5bba6 100644 --- a/Source/Modulos/Facturas proforma/FacturasProforma_Group.groupproj +++ b/Source/Modulos/Facturas proforma/FacturasProforma_Group.groupproj @@ -17,6 +17,9 @@ + + + @@ -155,6 +158,15 @@ + + + + + + + + + @@ -191,14 +203,32 @@ + + + + + + + + + + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Facturas proforma/Model/schFacturasProformaClient_Intf.pas b/Source/Modulos/Facturas proforma/Model/schFacturasProformaClient_Intf.pas index 67deefa..ab19fbd 100644 --- a/Source/Modulos/Facturas proforma/Model/schFacturasProformaClient_Intf.pas +++ b/Source/Modulos/Facturas proforma/Model/schFacturasProformaClient_Intf.pas @@ -9,9 +9,9 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_ListaAnosFacturas = '{FEEF09C4-67C8-4306-BC5D-E9B624ED4218}'; - RID_FacturasProforma = '{E96B0663-EB3C-45D1-8A6E-3A0178CC014A}'; - RID_FacturasProforma_Detalles = '{318BEE60-3B5B-4A8C-9A41-DFD51E23B35C}'; + RID_ListaAnosFacturas = '{6ABA008D-4E27-4110-A22A-B4BDFF577548}'; + RID_FacturasProforma = '{2F1B80A0-CF55-49A8-8B2B-9801332B05EC}'; + RID_FacturasProforma_Detalles = '{23C2166C-8FBB-4EEC-A206-FEB0089D74DC}'; { Data table names } nme_ListaAnosFacturas = 'ListaAnosFacturas'; @@ -60,9 +60,11 @@ const fld_FacturasProformaNUM_COPIAS = 'NUM_COPIAS'; fld_FacturasProformaNUM_CORREOS = 'NUM_CORREOS'; fld_FacturasProformaDATOS_BANCARIOS = 'DATOS_BANCARIOS'; - fld_FacturasProformaREFERENCIA_CLIENTE = 'REFERENCIA_CLIENTE'; fld_FacturasProformaID_PEDIDO = 'ID_PEDIDO'; + fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE = 'REFERENCIA_PEDIDO_CLIENTE'; + fld_FacturasProformaREFERENCIA_DEL_CLIENTE = 'REFERENCIA_DEL_CLIENTE'; fld_FacturasProformaID_FACTURA_FINAL = 'ID_FACTURA_FINAL'; + fld_FacturasProformaREFERENCIA_FACTURA_FINAL = 'REFERENCIA_FACTURA_FINAL'; { FacturasProforma field indexes } idx_FacturasProformaID = 0; @@ -100,9 +102,11 @@ const idx_FacturasProformaNUM_COPIAS = 32; idx_FacturasProformaNUM_CORREOS = 33; idx_FacturasProformaDATOS_BANCARIOS = 34; - idx_FacturasProformaREFERENCIA_CLIENTE = 35; - idx_FacturasProformaID_PEDIDO = 36; - idx_FacturasProformaID_FACTURA_FINAL = 37; + idx_FacturasProformaID_PEDIDO = 35; + idx_FacturasProformaREFERENCIA_PEDIDO_CLIENTE = 36; + idx_FacturasProformaREFERENCIA_DEL_CLIENTE = 37; + idx_FacturasProformaID_FACTURA_FINAL = 38; + idx_FacturasProformaREFERENCIA_FACTURA_FINAL = 39; { FacturasProforma_Detalles fields } fld_FacturasProforma_DetallesID = 'ID'; @@ -141,7 +145,7 @@ const type { IListaAnosFacturas } IListaAnosFacturas = interface(IDAStronglyTypedDataTable) - ['{CBCFE754-67D7-40A8-B21A-4450E8EC413F}'] + ['{5D8535C3-D8CF-446F-B6DF-02127DD9F379}'] { Property getters and setters } function GetANOValue: String; procedure SetANOValue(const aValue: String); @@ -176,7 +180,7 @@ type { IFacturasProforma } IFacturasProforma = interface(IDAStronglyTypedDataTable) - ['{F8DFF550-5A11-49CC-976D-93AEECB72322}'] + ['{77B940CF-32F0-43A2-A22E-A3611F90EE9C}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -317,18 +321,26 @@ type procedure SetDATOS_BANCARIOSValue(const aValue: String); function GetDATOS_BANCARIOSIsNull: Boolean; procedure SetDATOS_BANCARIOSIsNull(const aValue: Boolean); - function GetREFERENCIA_CLIENTEValue: String; - procedure SetREFERENCIA_CLIENTEValue(const aValue: String); - function GetREFERENCIA_CLIENTEIsNull: Boolean; - procedure SetREFERENCIA_CLIENTEIsNull(const aValue: Boolean); function GetID_PEDIDOValue: Integer; procedure SetID_PEDIDOValue(const aValue: Integer); function GetID_PEDIDOIsNull: Boolean; procedure SetID_PEDIDOIsNull(const aValue: Boolean); + function GetREFERENCIA_PEDIDO_CLIENTEValue: String; + procedure SetREFERENCIA_PEDIDO_CLIENTEValue(const aValue: String); + function GetREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; + procedure SetREFERENCIA_PEDIDO_CLIENTEIsNull(const aValue: Boolean); + function GetREFERENCIA_DEL_CLIENTEValue: String; + procedure SetREFERENCIA_DEL_CLIENTEValue(const aValue: String); + function GetREFERENCIA_DEL_CLIENTEIsNull: Boolean; + procedure SetREFERENCIA_DEL_CLIENTEIsNull(const aValue: Boolean); function GetID_FACTURA_FINALValue: Integer; procedure SetID_FACTURA_FINALValue(const aValue: Integer); function GetID_FACTURA_FINALIsNull: Boolean; procedure SetID_FACTURA_FINALIsNull(const aValue: Boolean); + function GetREFERENCIA_FACTURA_FINALValue: String; + procedure SetREFERENCIA_FACTURA_FINALValue(const aValue: String); + function GetREFERENCIA_FACTURA_FINALIsNull: Boolean; + procedure SetREFERENCIA_FACTURA_FINALIsNull(const aValue: Boolean); { Properties } @@ -402,12 +414,16 @@ type property NUM_CORREOSIsNull: Boolean read GetNUM_CORREOSIsNull write SetNUM_CORREOSIsNull; property DATOS_BANCARIOS: String read GetDATOS_BANCARIOSValue write SetDATOS_BANCARIOSValue; property DATOS_BANCARIOSIsNull: Boolean read GetDATOS_BANCARIOSIsNull write SetDATOS_BANCARIOSIsNull; - property REFERENCIA_CLIENTE: String read GetREFERENCIA_CLIENTEValue write SetREFERENCIA_CLIENTEValue; - property REFERENCIA_CLIENTEIsNull: Boolean read GetREFERENCIA_CLIENTEIsNull write SetREFERENCIA_CLIENTEIsNull; property ID_PEDIDO: Integer read GetID_PEDIDOValue write SetID_PEDIDOValue; property ID_PEDIDOIsNull: Boolean read GetID_PEDIDOIsNull write SetID_PEDIDOIsNull; + property REFERENCIA_PEDIDO_CLIENTE: String read GetREFERENCIA_PEDIDO_CLIENTEValue write SetREFERENCIA_PEDIDO_CLIENTEValue; + property REFERENCIA_PEDIDO_CLIENTEIsNull: Boolean read GetREFERENCIA_PEDIDO_CLIENTEIsNull write SetREFERENCIA_PEDIDO_CLIENTEIsNull; + property REFERENCIA_DEL_CLIENTE: String read GetREFERENCIA_DEL_CLIENTEValue write SetREFERENCIA_DEL_CLIENTEValue; + property REFERENCIA_DEL_CLIENTEIsNull: Boolean read GetREFERENCIA_DEL_CLIENTEIsNull write SetREFERENCIA_DEL_CLIENTEIsNull; property ID_FACTURA_FINAL: Integer read GetID_FACTURA_FINALValue write SetID_FACTURA_FINALValue; property ID_FACTURA_FINALIsNull: Boolean read GetID_FACTURA_FINALIsNull write SetID_FACTURA_FINALIsNull; + property REFERENCIA_FACTURA_FINAL: String read GetREFERENCIA_FACTURA_FINALValue write SetREFERENCIA_FACTURA_FINALValue; + property REFERENCIA_FACTURA_FINALIsNull: Boolean read GetREFERENCIA_FACTURA_FINALIsNull write SetREFERENCIA_FACTURA_FINALIsNull; end; { TFacturasProformaDataTableRules } @@ -556,18 +572,26 @@ type procedure SetDATOS_BANCARIOSValue(const aValue: String); virtual; function GetDATOS_BANCARIOSIsNull: Boolean; virtual; procedure SetDATOS_BANCARIOSIsNull(const aValue: Boolean); virtual; - function GetREFERENCIA_CLIENTEValue: String; virtual; - procedure SetREFERENCIA_CLIENTEValue(const aValue: String); virtual; - function GetREFERENCIA_CLIENTEIsNull: Boolean; virtual; - procedure SetREFERENCIA_CLIENTEIsNull(const aValue: Boolean); virtual; function GetID_PEDIDOValue: Integer; virtual; procedure SetID_PEDIDOValue(const aValue: Integer); virtual; function GetID_PEDIDOIsNull: Boolean; virtual; procedure SetID_PEDIDOIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_PEDIDO_CLIENTEValue: String; virtual; + procedure SetREFERENCIA_PEDIDO_CLIENTEValue(const aValue: String); virtual; + function GetREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; virtual; + procedure SetREFERENCIA_PEDIDO_CLIENTEIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_DEL_CLIENTEValue: String; virtual; + procedure SetREFERENCIA_DEL_CLIENTEValue(const aValue: String); virtual; + function GetREFERENCIA_DEL_CLIENTEIsNull: Boolean; virtual; + procedure SetREFERENCIA_DEL_CLIENTEIsNull(const aValue: Boolean); virtual; function GetID_FACTURA_FINALValue: Integer; virtual; procedure SetID_FACTURA_FINALValue(const aValue: Integer); virtual; function GetID_FACTURA_FINALIsNull: Boolean; virtual; procedure SetID_FACTURA_FINALIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_FACTURA_FINALValue: String; virtual; + procedure SetREFERENCIA_FACTURA_FINALValue(const aValue: String); virtual; + function GetREFERENCIA_FACTURA_FINALIsNull: Boolean; virtual; + procedure SetREFERENCIA_FACTURA_FINALIsNull(const aValue: Boolean); virtual; { Properties } property ID: Integer read GetIDValue write SetIDValue; @@ -640,12 +664,16 @@ type property NUM_CORREOSIsNull: Boolean read GetNUM_CORREOSIsNull write SetNUM_CORREOSIsNull; property DATOS_BANCARIOS: String read GetDATOS_BANCARIOSValue write SetDATOS_BANCARIOSValue; property DATOS_BANCARIOSIsNull: Boolean read GetDATOS_BANCARIOSIsNull write SetDATOS_BANCARIOSIsNull; - property REFERENCIA_CLIENTE: String read GetREFERENCIA_CLIENTEValue write SetREFERENCIA_CLIENTEValue; - property REFERENCIA_CLIENTEIsNull: Boolean read GetREFERENCIA_CLIENTEIsNull write SetREFERENCIA_CLIENTEIsNull; property ID_PEDIDO: Integer read GetID_PEDIDOValue write SetID_PEDIDOValue; property ID_PEDIDOIsNull: Boolean read GetID_PEDIDOIsNull write SetID_PEDIDOIsNull; + property REFERENCIA_PEDIDO_CLIENTE: String read GetREFERENCIA_PEDIDO_CLIENTEValue write SetREFERENCIA_PEDIDO_CLIENTEValue; + property REFERENCIA_PEDIDO_CLIENTEIsNull: Boolean read GetREFERENCIA_PEDIDO_CLIENTEIsNull write SetREFERENCIA_PEDIDO_CLIENTEIsNull; + property REFERENCIA_DEL_CLIENTE: String read GetREFERENCIA_DEL_CLIENTEValue write SetREFERENCIA_DEL_CLIENTEValue; + property REFERENCIA_DEL_CLIENTEIsNull: Boolean read GetREFERENCIA_DEL_CLIENTEIsNull write SetREFERENCIA_DEL_CLIENTEIsNull; property ID_FACTURA_FINAL: Integer read GetID_FACTURA_FINALValue write SetID_FACTURA_FINALValue; property ID_FACTURA_FINALIsNull: Boolean read GetID_FACTURA_FINALIsNull write SetID_FACTURA_FINALIsNull; + property REFERENCIA_FACTURA_FINAL: String read GetREFERENCIA_FACTURA_FINALValue write SetREFERENCIA_FACTURA_FINALValue; + property REFERENCIA_FACTURA_FINALIsNull: Boolean read GetREFERENCIA_FACTURA_FINALIsNull write SetREFERENCIA_FACTURA_FINALIsNull; public constructor Create(aDataTable: TDADataTable); override; @@ -655,7 +683,7 @@ type { IFacturasProforma_Detalles } IFacturasProforma_Detalles = interface(IDAStronglyTypedDataTable) - ['{B411FAE4-15F3-4FFB-B84A-6E0BFDF91CE9}'] + ['{3A9B54FE-6094-4A20-A8CC-C3E186530F62}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -1646,27 +1674,6 @@ begin DataTable.Fields[idx_FacturasProformaDATOS_BANCARIOS].AsVariant := Null; end; -function TFacturasProformaDataTableRules.GetREFERENCIA_CLIENTEValue: String; -begin - result := DataTable.Fields[idx_FacturasProformaREFERENCIA_CLIENTE].AsString; -end; - -procedure TFacturasProformaDataTableRules.SetREFERENCIA_CLIENTEValue(const aValue: String); -begin - DataTable.Fields[idx_FacturasProformaREFERENCIA_CLIENTE].AsString := aValue; -end; - -function TFacturasProformaDataTableRules.GetREFERENCIA_CLIENTEIsNull: boolean; -begin - result := DataTable.Fields[idx_FacturasProformaREFERENCIA_CLIENTE].IsNull; -end; - -procedure TFacturasProformaDataTableRules.SetREFERENCIA_CLIENTEIsNull(const aValue: Boolean); -begin - if aValue then - DataTable.Fields[idx_FacturasProformaREFERENCIA_CLIENTE].AsVariant := Null; -end; - function TFacturasProformaDataTableRules.GetID_PEDIDOValue: Integer; begin result := DataTable.Fields[idx_FacturasProformaID_PEDIDO].AsInteger; @@ -1688,6 +1695,48 @@ begin DataTable.Fields[idx_FacturasProformaID_PEDIDO].AsVariant := Null; end; +function TFacturasProformaDataTableRules.GetREFERENCIA_PEDIDO_CLIENTEValue: String; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_PEDIDO_CLIENTE].AsString; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_PEDIDO_CLIENTEValue(const aValue: String); +begin + DataTable.Fields[idx_FacturasProformaREFERENCIA_PEDIDO_CLIENTE].AsString := aValue; +end; + +function TFacturasProformaDataTableRules.GetREFERENCIA_PEDIDO_CLIENTEIsNull: boolean; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_PEDIDO_CLIENTE].IsNull; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_PEDIDO_CLIENTEIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_FacturasProformaREFERENCIA_PEDIDO_CLIENTE].AsVariant := Null; +end; + +function TFacturasProformaDataTableRules.GetREFERENCIA_DEL_CLIENTEValue: String; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_DEL_CLIENTE].AsString; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_DEL_CLIENTEValue(const aValue: String); +begin + DataTable.Fields[idx_FacturasProformaREFERENCIA_DEL_CLIENTE].AsString := aValue; +end; + +function TFacturasProformaDataTableRules.GetREFERENCIA_DEL_CLIENTEIsNull: boolean; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_DEL_CLIENTE].IsNull; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_DEL_CLIENTEIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_FacturasProformaREFERENCIA_DEL_CLIENTE].AsVariant := Null; +end; + function TFacturasProformaDataTableRules.GetID_FACTURA_FINALValue: Integer; begin result := DataTable.Fields[idx_FacturasProformaID_FACTURA_FINAL].AsInteger; @@ -1709,6 +1758,27 @@ begin DataTable.Fields[idx_FacturasProformaID_FACTURA_FINAL].AsVariant := Null; end; +function TFacturasProformaDataTableRules.GetREFERENCIA_FACTURA_FINALValue: String; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_FACTURA_FINAL].AsString; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_FACTURA_FINALValue(const aValue: String); +begin + DataTable.Fields[idx_FacturasProformaREFERENCIA_FACTURA_FINAL].AsString := aValue; +end; + +function TFacturasProformaDataTableRules.GetREFERENCIA_FACTURA_FINALIsNull: boolean; +begin + result := DataTable.Fields[idx_FacturasProformaREFERENCIA_FACTURA_FINAL].IsNull; +end; + +procedure TFacturasProformaDataTableRules.SetREFERENCIA_FACTURA_FINALIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_FacturasProformaREFERENCIA_FACTURA_FINAL].AsVariant := Null; +end; + { TFacturasProforma_DetallesDataTableRules } constructor TFacturasProforma_DetallesDataTableRules.Create(aDataTable: TDADataTable); diff --git a/Source/Modulos/Facturas proforma/Model/schFacturasProformaServer_Intf.pas b/Source/Modulos/Facturas proforma/Model/schFacturasProformaServer_Intf.pas index 2d8f848..4d245b4 100644 --- a/Source/Modulos/Facturas proforma/Model/schFacturasProformaServer_Intf.pas +++ b/Source/Modulos/Facturas proforma/Model/schFacturasProformaServer_Intf.pas @@ -9,14 +9,14 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_ListaAnosFacturasDelta = '{1E0FB8B9-0971-4C08-9852-81F821095795}'; - RID_FacturasProformaDelta = '{8CCB35B8-FB46-40BB-8D1C-F22A11E81325}'; - RID_FacturasProforma_DetallesDelta = '{9C6DD5EA-A831-40AF-AAF2-792029C0567D}'; + RID_ListaAnosFacturasDelta = '{B56B2864-B139-4368-9643-757950948319}'; + RID_FacturasProformaDelta = '{6517D416-A2B8-40EF-BE1A-056BBC8D08BE}'; + RID_FacturasProforma_DetallesDelta = '{88B55B8E-BF8A-49C0-B26F-6BDDDFD872DD}'; type { IListaAnosFacturasDelta } IListaAnosFacturasDelta = interface(IListaAnosFacturas) - ['{1E0FB8B9-0971-4C08-9852-81F821095795}'] + ['{B56B2864-B139-4368-9643-757950948319}'] { Property getters and setters } function GetOldANOValue : String; @@ -50,7 +50,7 @@ type { IFacturasProformaDelta } IFacturasProformaDelta = interface(IFacturasProforma) - ['{8CCB35B8-FB46-40BB-8D1C-F22A11E81325}'] + ['{6517D416-A2B8-40EF-BE1A-056BBC8D08BE}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -87,9 +87,11 @@ type function GetOldNUM_COPIASValue : SmallInt; function GetOldNUM_CORREOSValue : SmallInt; function GetOldDATOS_BANCARIOSValue : String; - function GetOldREFERENCIA_CLIENTEValue : String; function GetOldID_PEDIDOValue : Integer; + function GetOldREFERENCIA_PEDIDO_CLIENTEValue : String; + function GetOldREFERENCIA_DEL_CLIENTEValue : String; function GetOldID_FACTURA_FINALValue : Integer; + function GetOldREFERENCIA_FACTURA_FINALValue : String; { Properties } property OldID : Integer read GetOldIDValue; @@ -127,9 +129,11 @@ type property OldNUM_COPIAS : SmallInt read GetOldNUM_COPIASValue; property OldNUM_CORREOS : SmallInt read GetOldNUM_CORREOSValue; property OldDATOS_BANCARIOS : String read GetOldDATOS_BANCARIOSValue; - property OldREFERENCIA_CLIENTE : String read GetOldREFERENCIA_CLIENTEValue; property OldID_PEDIDO : Integer read GetOldID_PEDIDOValue; + property OldREFERENCIA_PEDIDO_CLIENTE : String read GetOldREFERENCIA_PEDIDO_CLIENTEValue; + property OldREFERENCIA_DEL_CLIENTE : String read GetOldREFERENCIA_DEL_CLIENTEValue; property OldID_FACTURA_FINAL : Integer read GetOldID_FACTURA_FINALValue; + property OldREFERENCIA_FACTURA_FINAL : String read GetOldREFERENCIA_FACTURA_FINALValue; end; { TFacturasProformaBusinessProcessorRules } @@ -348,24 +352,36 @@ type function GetOldDATOS_BANCARIOSIsNull: Boolean; virtual; procedure SetDATOS_BANCARIOSValue(const aValue: String); virtual; procedure SetDATOS_BANCARIOSIsNull(const aValue: Boolean); virtual; - function GetREFERENCIA_CLIENTEValue: String; virtual; - function GetREFERENCIA_CLIENTEIsNull: Boolean; virtual; - function GetOldREFERENCIA_CLIENTEValue: String; virtual; - function GetOldREFERENCIA_CLIENTEIsNull: Boolean; virtual; - procedure SetREFERENCIA_CLIENTEValue(const aValue: String); virtual; - procedure SetREFERENCIA_CLIENTEIsNull(const aValue: Boolean); virtual; function GetID_PEDIDOValue: Integer; virtual; function GetID_PEDIDOIsNull: Boolean; virtual; function GetOldID_PEDIDOValue: Integer; virtual; function GetOldID_PEDIDOIsNull: Boolean; virtual; procedure SetID_PEDIDOValue(const aValue: Integer); virtual; procedure SetID_PEDIDOIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_PEDIDO_CLIENTEValue: String; virtual; + function GetREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; virtual; + function GetOldREFERENCIA_PEDIDO_CLIENTEValue: String; virtual; + function GetOldREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; virtual; + procedure SetREFERENCIA_PEDIDO_CLIENTEValue(const aValue: String); virtual; + procedure SetREFERENCIA_PEDIDO_CLIENTEIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_DEL_CLIENTEValue: String; virtual; + function GetREFERENCIA_DEL_CLIENTEIsNull: Boolean; virtual; + function GetOldREFERENCIA_DEL_CLIENTEValue: String; virtual; + function GetOldREFERENCIA_DEL_CLIENTEIsNull: Boolean; virtual; + procedure SetREFERENCIA_DEL_CLIENTEValue(const aValue: String); virtual; + procedure SetREFERENCIA_DEL_CLIENTEIsNull(const aValue: Boolean); virtual; function GetID_FACTURA_FINALValue: Integer; virtual; function GetID_FACTURA_FINALIsNull: Boolean; virtual; function GetOldID_FACTURA_FINALValue: Integer; virtual; function GetOldID_FACTURA_FINALIsNull: Boolean; virtual; procedure SetID_FACTURA_FINALValue(const aValue: Integer); virtual; procedure SetID_FACTURA_FINALIsNull(const aValue: Boolean); virtual; + function GetREFERENCIA_FACTURA_FINALValue: String; virtual; + function GetREFERENCIA_FACTURA_FINALIsNull: Boolean; virtual; + function GetOldREFERENCIA_FACTURA_FINALValue: String; virtual; + function GetOldREFERENCIA_FACTURA_FINALIsNull: Boolean; virtual; + procedure SetREFERENCIA_FACTURA_FINALValue(const aValue: String); virtual; + procedure SetREFERENCIA_FACTURA_FINALIsNull(const aValue: Boolean); virtual; { Properties } property ID : Integer read GetIDValue write SetIDValue; @@ -508,18 +524,26 @@ type property DATOS_BANCARIOSIsNull : Boolean read GetDATOS_BANCARIOSIsNull write SetDATOS_BANCARIOSIsNull; property OldDATOS_BANCARIOS : String read GetOldDATOS_BANCARIOSValue; property OldDATOS_BANCARIOSIsNull : Boolean read GetOldDATOS_BANCARIOSIsNull; - property REFERENCIA_CLIENTE : String read GetREFERENCIA_CLIENTEValue write SetREFERENCIA_CLIENTEValue; - property REFERENCIA_CLIENTEIsNull : Boolean read GetREFERENCIA_CLIENTEIsNull write SetREFERENCIA_CLIENTEIsNull; - property OldREFERENCIA_CLIENTE : String read GetOldREFERENCIA_CLIENTEValue; - property OldREFERENCIA_CLIENTEIsNull : Boolean read GetOldREFERENCIA_CLIENTEIsNull; property ID_PEDIDO : Integer read GetID_PEDIDOValue write SetID_PEDIDOValue; property ID_PEDIDOIsNull : Boolean read GetID_PEDIDOIsNull write SetID_PEDIDOIsNull; property OldID_PEDIDO : Integer read GetOldID_PEDIDOValue; property OldID_PEDIDOIsNull : Boolean read GetOldID_PEDIDOIsNull; + property REFERENCIA_PEDIDO_CLIENTE : String read GetREFERENCIA_PEDIDO_CLIENTEValue write SetREFERENCIA_PEDIDO_CLIENTEValue; + property REFERENCIA_PEDIDO_CLIENTEIsNull : Boolean read GetREFERENCIA_PEDIDO_CLIENTEIsNull write SetREFERENCIA_PEDIDO_CLIENTEIsNull; + property OldREFERENCIA_PEDIDO_CLIENTE : String read GetOldREFERENCIA_PEDIDO_CLIENTEValue; + property OldREFERENCIA_PEDIDO_CLIENTEIsNull : Boolean read GetOldREFERENCIA_PEDIDO_CLIENTEIsNull; + property REFERENCIA_DEL_CLIENTE : String read GetREFERENCIA_DEL_CLIENTEValue write SetREFERENCIA_DEL_CLIENTEValue; + property REFERENCIA_DEL_CLIENTEIsNull : Boolean read GetREFERENCIA_DEL_CLIENTEIsNull write SetREFERENCIA_DEL_CLIENTEIsNull; + property OldREFERENCIA_DEL_CLIENTE : String read GetOldREFERENCIA_DEL_CLIENTEValue; + property OldREFERENCIA_DEL_CLIENTEIsNull : Boolean read GetOldREFERENCIA_DEL_CLIENTEIsNull; property ID_FACTURA_FINAL : Integer read GetID_FACTURA_FINALValue write SetID_FACTURA_FINALValue; property ID_FACTURA_FINALIsNull : Boolean read GetID_FACTURA_FINALIsNull write SetID_FACTURA_FINALIsNull; property OldID_FACTURA_FINAL : Integer read GetOldID_FACTURA_FINALValue; property OldID_FACTURA_FINALIsNull : Boolean read GetOldID_FACTURA_FINALIsNull; + property REFERENCIA_FACTURA_FINAL : String read GetREFERENCIA_FACTURA_FINALValue write SetREFERENCIA_FACTURA_FINALValue; + property REFERENCIA_FACTURA_FINALIsNull : Boolean read GetREFERENCIA_FACTURA_FINALIsNull write SetREFERENCIA_FACTURA_FINALIsNull; + property OldREFERENCIA_FACTURA_FINAL : String read GetOldREFERENCIA_FACTURA_FINALValue; + property OldREFERENCIA_FACTURA_FINALIsNull : Boolean read GetOldREFERENCIA_FACTURA_FINALIsNull; public constructor Create(aBusinessProcessor: TDABusinessProcessor); override; @@ -529,7 +553,7 @@ type { IFacturasProforma_DetallesDelta } IFacturasProforma_DetallesDelta = interface(IFacturasProforma_Detalles) - ['{9C6DD5EA-A831-40AF-AAF2-792029C0567D}'] + ['{88B55B8E-BF8A-49C0-B26F-6BDDDFD872DD}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FACTURAValue : Integer; @@ -1881,37 +1905,6 @@ begin BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaDATOS_BANCARIOS] := Null; end; -function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_CLIENTEValue: String; -begin - result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_CLIENTE]; -end; - -function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_CLIENTEIsNull: Boolean; -begin - result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_CLIENTE]); -end; - -function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_CLIENTEValue: String; -begin - result := BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_CLIENTE]; -end; - -function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_CLIENTEIsNull: Boolean; -begin - result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_CLIENTE]); -end; - -procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_CLIENTEValue(const aValue: String); -begin - BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_CLIENTE] := aValue; -end; - -procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_CLIENTEIsNull(const aValue: Boolean); -begin - if aValue then - BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_CLIENTE] := Null; -end; - function TFacturasProformaBusinessProcessorRules.GetID_PEDIDOValue: Integer; begin result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaID_PEDIDO]; @@ -1943,6 +1936,68 @@ begin BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaID_PEDIDO] := Null; end; +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_PEDIDO_CLIENTEValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE]; +end; + +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE]); +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_PEDIDO_CLIENTEValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE]; +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_PEDIDO_CLIENTEIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE]); +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_PEDIDO_CLIENTEValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE] := aValue; +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_PEDIDO_CLIENTEIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_PEDIDO_CLIENTE] := Null; +end; + +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_DEL_CLIENTEValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE]; +end; + +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_DEL_CLIENTEIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE]); +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_DEL_CLIENTEValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE]; +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_DEL_CLIENTEIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE]); +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_DEL_CLIENTEValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE] := aValue; +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_DEL_CLIENTEIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_DEL_CLIENTE] := Null; +end; + function TFacturasProformaBusinessProcessorRules.GetID_FACTURA_FINALValue: Integer; begin result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaID_FACTURA_FINAL]; @@ -1974,6 +2029,37 @@ begin BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaID_FACTURA_FINAL] := Null; end; +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_FACTURA_FINALValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL]; +end; + +function TFacturasProformaBusinessProcessorRules.GetREFERENCIA_FACTURA_FINALIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL]); +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_FACTURA_FINALValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL]; +end; + +function TFacturasProformaBusinessProcessorRules.GetOldREFERENCIA_FACTURA_FINALIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL]); +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_FACTURA_FINALValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL] := aValue; +end; + +procedure TFacturasProformaBusinessProcessorRules.SetREFERENCIA_FACTURA_FINALIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_FacturasProformaREFERENCIA_FACTURA_FINAL] := Null; +end; + { TFacturasProforma_DetallesBusinessProcessorRules } constructor TFacturasProforma_DetallesBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); diff --git a/Source/Modulos/Facturas proforma/Plugin/FacturasProforma_plugin.drc b/Source/Modulos/Facturas proforma/Plugin/FacturasProforma_plugin.drc index ef00be8..0fe7cf3 100644 --- a/Source/Modulos/Facturas proforma/Plugin/FacturasProforma_plugin.drc +++ b/Source/Modulos/Facturas proforma/Plugin/FacturasProforma_plugin.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Facturas proforma\Plugin\uPluginFacturasProforma.dfm */ /* C:\Codigo\Source\Modulos\Facturas proforma\Plugin\FacturasProforma_plugin.res */ -/* C:\Codigo\Source\Modulos\Facturas proforma\Plugin\FacturasProforma_plugin.drf */ +/* c:\temp\dtf3E0.tmp */ diff --git a/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.dfm b/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.dfm index a799209..da4d97c 100644 --- a/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.dfm +++ b/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.dfm @@ -7,630 +7,30 @@ object RptFacturasProforma: TRptFacturasProforma object schReport: TDASchema ConnectionManager = dmServer.ConnectionManager Datasets = < - item - Params = < - item - Name = 'ID_EMPRESA' - Value = '' - end - item - Name = 'ANO' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end - item - Name = 'NTOP' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + - ', sum (IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO,'#10'sum (IMPORTE_DES' + - 'CUENTO2) as IMPORTE_DESCUENTO2, sum (IMPORTE_TOTAL) as IMPORTE_T' + - 'OTAL, sum (IMPORTE_COBRADO) as IMPORTE_COBRADO,'#10'sum (PORCENTAJE)' + - ' as PORCENTAJE'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESC' + - 'E(C.NOMBRE, P.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2,'#10'SUM(P' + - '.IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO, 0 as IMPORTE_DESCUENTO' + - '2, SUM(P.IMPORTE_NETO) as IMPORTE_TOTAL,'#10'SUM(P.IMPORTE_TOTAL) as' + - ' IMPORTE_COBRADO,'#10'case when SUM(P.IMPORTE_NETO) = 0 then 0'#10'else ' + - '((SUM(P.IMPORTE_DESCUENTO) * 100) / SUM(P.IMPORTE_NETO)) end as ' + - 'PORCENTAJE'#10#10'from V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C o' + - 'n P.ID_CLIENTE = C.ID'#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO' + - ' = :ANO'#10'group by 1,2,3,4'#10#10'union'#10#10'select C2.REFERENCIA as REFEREN' + - 'CIA, COALESCE(C2.NOMBRE, P2.NOMBRE) as NOMBRE, 0 as ANO1, P2.ANO' + - ' as ANO2,'#10' 0 as IMPORTE_DESCUENTO, SUM(P2.IMPORTE_DESCUENTO) as ' + - 'IMPORTE_DESCUENTO2, 0 as IMPORTE_TOTAL,'#10' 0 as IMPORTE_COBRADO, 0' + - ' as PORCENTAJE'#10'from V_INF_FAC_DET_CLIENTE P2'#10'left join CONTACTOS' + - ' C2 on P2.ID_CLIENTE = C2.ID'#10'where p2.ID_EMPRESA = :ID_EMPRESA'#10'a' + - 'nd P2.ANO = :ANO2'#10'group by 1,2,3,4,5'#10')'#10#10'group by 1,2'#10'having (sum' + - '(ANO1) > 0)'#10'order by 3,5 desc'#10'rows 1 to :NTOP'#10#10#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'REFERENCIA' - TableField = 'REFERENCIA' - end - item - DatasetField = 'NOMBRE' - TableField = 'NOMBRE' - end - item - DatasetField = 'IMPORTE_DESCUENTO' - TableField = 'IMPORTE_DESCUENTO' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end - item - DatasetField = 'IMPORTE_COBRADO' - TableField = 'IMPORTE_COBRADO' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_DESCUENTO2' - TableField = 'IMPORTE_DESCUENTO2' - end> - end> - Name = 'InformeListadoClientesMayorDescuentoResumen' - Fields = < - item - Name = 'REFERENCIA' - DataType = datString - Size = 255 - end - item - Name = 'NOMBRE' - DataType = datString - Size = 255 - end - item - Name = 'ANO1' - DataType = datLargeInt - end - item - Name = 'ANO2' - DataType = datLargeInt - end - item - Name = 'IMPORTE_DESCUENTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DESCUENTO2' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end - item - Name = 'IMPORTE_COBRADO' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datDecimal - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select VALOR, DESCRIPCION, periodo1.ANO as Ano1, periodo1.IMPORT' + - 'E_TOTAL, periodo2.ANO as Ano2, periodo2.IMPORTE_TOTAL,'#10#10'(periodo' + - '1.IMPORTE_TOTAL - periodo2.IMPORTE_TOTAL) as Diferencia,'#10'/*SOLO ' + - 'COMPARAREMOS CUANDO EL SEGUNDO A'#209'O SEA DIFERENTE DE 0, comparati' + - 'va de A'#241'o1 respecto A'#241'o2*/'#10'case'#10'when (periodo1.IMPORTE_TOTAL = 0' + - ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + - 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + - #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, SEMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL' + - #10'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'an' + - 'd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 o' + - 'n (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, ' + - 'comp2.ANO, SEMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMPOR' + - 'TE_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMP' + - 'RESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) pe' + - 'riodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'SEMESTRAL'#39#10'o' + - 'rder by valor asc'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_TOTAL1' - TableField = 'IMPORTE_TOTAL1' - end - item - DatasetField = 'DIFERENCIA' - TableField = 'DIFERENCIA' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end> - end> - Name = 'InformeListadoFacturasGrafCompSemestral' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL1' - DataType = datCurrency - end - item - Name = 'DIFERENCIA' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select VALOR, DESCRIPCION, periodo1.ANO as Ano1, periodo1.IMPORT' + - 'E_TOTAL, periodo2.ANO as Ano2, periodo2.IMPORTE_TOTAL,'#10#10'(periodo' + - '1.IMPORTE_TOTAL - periodo2.IMPORTE_TOTAL) as Diferencia,'#10'/*SOLO ' + - 'COMPARAREMOS CUANDO EL SEGUNDO A'#209'O SEA DIFERENTE DE 0, comparati' + - 'va de A'#241'o1 respecto A'#241'o2*/'#10'case'#10'when (periodo1.IMPORTE_TOTAL = 0' + - ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + - 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + - #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, MES as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from' + - ' V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (AN' + - 'O = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on (VA' + - 'LOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, comp2' + - '.ANO, MES as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'f' + - 'rom V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and ' + - '(ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo2 on ' + - '(VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'MENSUAL'#39#10'order by valo' + - 'r asc'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_TOTAL1' - TableField = 'IMPORTE_TOTAL1' - end - item - DatasetField = 'DIFERENCIA' - TableField = 'DIFERENCIA' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end> - end> - Name = 'InformeListadoFacturasGrafCompMensual' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL1' - DataType = datCurrency - end - item - Name = 'DIFERENCIA' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA' - Value = '' - end - item - Name = 'ANO' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end - item - Name = 'NTOP' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + - ', sum (Importe_TOTAL_ANO) as IMPORTE_TOTAL_ANO,'#10'sum (NUMFAC) as ' + - 'NUMFAC, sum (IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO1, sum (IMPORTE_' + - 'TOTAL_ANO2) as IMPORTE_TOTAL_ANO2,'#10'sum (PORCENTAJE) as PORCENTAJ' + - 'E'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESCE(C.NOMBRE, P' + - '.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2, p.Importe_TOTAL_AN' + - 'O,'#10'COUNT(P.FECHA_FACTURA) as NUMFAC, SUM(P.BASE_IMPONIBLE) as IM' + - 'PORTE_TOTAL, 0 as IMPORTE_TOTAL_ANO2,'#10'((SUM(P.BASE_IMPONIBLE)*10' + - '0)/p.Importe_TOTAL_ANO) as PORCENTAJE'#10'from V_INF_FAC_CLIENTE P'#10'l' + - 'eft join CONTACTOS C on P.ID_CLIENTE = C.ID'#10'where p.ID_EMPRESA =' + - ' :ID_EMPRESA'#10'and P.ANO = :ANO'#10'group by 1,2,3,4,5'#10#10'union'#10#10'select ' + - 'C2.REFERENCIA as REFERENCIA, COALESCE(C2.NOMBRE, P2.NOMBRE) as N' + - 'OMBRE, 0 as ANO1, P2.ANO as ANO2, 0 as Importe_TOTAL_ANO,'#10'0 as N' + - 'UMFAC, 0 as IMPORTE_TOTAL, SUM(P2.BASE_IMPONIBLE) as IMPORTE_TOT' + - 'AL_ANO2, 0 as PORCENTAJE'#10'from V_INF_FAC_CLIENTE P2'#10'left join CON' + - 'TACTOS C2 on P2.ID_CLIENTE = C2.ID'#10'where p2.ID_EMPRESA = :ID_EMP' + - 'RESA'#10'and P2.ANO = :ANO2'#10'group by 1,2,3,4,5,6,7'#10')'#10#10'group by 1,2'#10'h' + - 'aving (sum(ANO1) > 0)'#10'order by 3,7 desc'#10'rows 1 to :NTOP'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'REFERENCIA' - TableField = 'REFERENCIA' - end - item - DatasetField = 'NOMBRE' - TableField = 'NOMBRE' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO' - TableField = 'IMPORTE_TOTAL_ANO' - end - item - DatasetField = 'NUMFAC' - TableField = 'NUMFAC' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO1' - TableField = 'IMPORTE_TOTAL_ANO1' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO2' - TableField = 'IMPORTE_TOTAL_ANO2' - end> - end> - Name = 'InformeListadoClientesMayorFacturacionResumen' - Fields = < - item - Name = 'REFERENCIA' - DataType = datString - Size = 255 - end - item - Name = 'NOMBRE' - DataType = datString - Size = 255 - end - item - Name = 'ANO1' - DataType = datLargeInt - end - item - Name = 'ANO2' - DataType = datLargeInt - end - item - Name = 'IMPORTE_TOTAL_ANO' - DataType = datCurrency - end - item - Name = 'NUMFAC' - DataType = datLargeInt - end - item - Name = 'IMPORTE_TOTAL_ANO1' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_ANO2' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select VALOR, DESCRIPCION, periodo1.ANO as Ano1, periodo1.IMPORT' + - 'E_TOTAL, periodo2.ANO as Ano2, periodo2.IMPORTE_TOTAL,'#10#10'(periodo' + - '1.IMPORTE_TOTAL - periodo2.IMPORTE_TOTAL) as Diferencia,'#10'/*SOLO ' + - 'COMPARAREMOS CUANDO EL SEGUNDO A'#209'O SEA DIFERENTE DE 0, comparati' + - 'va de A'#241'o1 respecto A'#241'o2*/'#10'case'#10'when (periodo1.IMPORTE_TOTAL = 0' + - ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + - 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + - #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, TRIMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTA' + - 'L'#10'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'a' + - 'nd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 ' + - 'on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA,' + - ' comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMP' + - 'ORTE_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_E' + - 'MPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) ' + - 'periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'TRIMESTRAL' + - #39#10'order by valor asc'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_TOTAL1' - TableField = 'IMPORTE_TOTAL1' - end - item - DatasetField = 'DIFERENCIA' - TableField = 'DIFERENCIA' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end> - end> - Name = 'InformeListadoFacturasGrafCompTrimestral' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'IMPORTE_TOTAL1' - DataType = datCurrency - end - item - Name = 'DIFERENCIA' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datCurrency - end> - end item Params = < item Name = 'ID' DataType = datInteger - Value = '1' - ParamType = daptInput + Value = '' end> Statements = < item Connection = 'IBX' + TargetTable = 'V_FACTURAS_PROFORMA' SQL = - 'SELECT'#10' FACTURAS_CLIENTE.ID, FACTURAS_CLIENTE.REFERENCIA, FAC' + - 'TURAS_CLIENTE.FECHA_FACTURA,'#10' CASE WHEN (FACTURAS_CLIENTE.IMP' + - 'ORTE_TOTAL < 0) THEN '#39'A'#39' ELSE '#39'F'#39' END AS TIPO,'#10'/*'#10' v_facturas' + - '_cliente.situacion,'#10'*/'#10' FACTURAS_CLIENTE.BASE_IMPONIBLE, FACT' + - 'URAS_CLIENTE.DESCUENTO, FACTURAS_CLIENTE.IMPORTE_DESCUENTO,'#10' ' + - 'FACTURAS_CLIENTE.IVA, FACTURAS_CLIENTE.IMPORTE_IVA,'#10' FACTURAS' + - '_CLIENTE.RE, FACTURAS_CLIENTE.IMPORTE_RE,'#10' FACTURAS_CLIENTE.I' + - 'MPORTE_TOTAL,'#10' FACTURAS_CLIENTE.OBSERVACIONES, FORMAS_PAGO.DE' + - 'SCRIPCION AS FORMA_PAGO, FACTURAS_CLIENTE.ID_CLIENTE,'#10' FACTUR' + - 'AS_CLIENTE.NIF_CIF, FACTURAS_CLIENTE.NOMBRE, FACTURAS_CLIENTE.CA' + - 'LLE,'#10' FACTURAS_CLIENTE.PROVINCIA, FACTURAS_CLIENTE.CODIGO_POS' + - 'TAL, FACTURAS_CLIENTE.POBLACION,'#10#10' CONTACTOS_DATOS_BANCO.TITU' + - 'LAR,'#10' CONTACTOS_DATOS_BANCO.ENTIDAD,'#10' CONTACTOS_DATOS_BANC' + - 'O.SUCURSAL,'#10' CONTACTOS_DATOS_BANCO.DC,'#10' CONTACTOS_DATOS_BA' + - 'NCO.CUENTA,'#10#10' ID_EMPRESA, EMPRESAS.NIF_CIF as NIF_CIF_EMPRESA' + - ', EMPRESAS.RAZON_SOCIAL,'#10' EMPRESAS.CALLE as CALLE_EMPRESA, EM' + - 'PRESAS.POBLACION as POBLACION_EMPRESA,'#10' EMPRESAS.PROVINCIA as' + - ' PROVINCIA_EMPRESA, EMPRESAS.CODIGO_POSTAL as CODIGO_POSTAL_EMPR' + - 'ESA,'#10' EMPRESAS.TELEFONO_1, EMPRESAS.FAX, EMPRESAS.MOVIL_1, EM' + - 'PRESAS.EMAIL_1,'#10' EMPRESAS.PAGINA_WEB, EMPRESAS.REGISTRO_MERCA' + - 'NTIL, EMPRESAS.LOGOTIPO'#10#10'FROM FACTURAS_CLIENTE'#10#10'LEFT JOIN EMPRES' + - 'AS ON EMPRESAS.ID = ID_EMPRESA'#10'LEFT JOIN FORMAS_PAGO ON (FORMAS_' + - 'PAGO.ID = FACTURAS_CLIENTE.ID_FORMA_PAGO)'#10'LEFT JOIN CONTACTOS_DA' + - 'TOS_BANCO ON (CONTACTOS_DATOS_BANCO.ID_CONTACTO = FACTURAS_CLIEN' + - 'TE.ID_CLIENTE)'#10#10'WHERE FACTURAS_CLIENTE.ID = :ID'#10#10 + 'SELECT '#10' V.ID, V.ID_EMPRESA, V.REFERENCIA, V.FECHA_FACTURA, V' + + '.FECHA_VENCIMIENTO,'#10' V.SITUACION, V.BASE_IMPONIBLE, V.DESCUEN' + + 'TO, V.IMPORTE_DESCUENTO,'#10' V.DESCRIPCION_DESCUENTO, V.IVA, V.I' + + 'MPORTE_IVA, V.RE, V.IMPORTE_RE,'#10' V.IMPORTE_TOTAL, V.OBSERVACI' + + 'ONES, V.ID_CLIENTE, V.NIF_CIF,'#10' V.NOMBRE, V.ID_DIRECCION, V.C' + + 'ALLE, V.POBLACION, V.PROVINCIA,'#10' V.CODIGO_POSTAL, V.FECHA_ALT' + + 'A, V.FECHA_MODIFICACION, V.USUARIO,'#10' V.ID_FORMA_PAGO, V.RECAR' + + 'GO_EQUIVALENCIA, V.ID_TIPO_IVA, V.IMPORTE_NETO,'#10' V.IMPORTE_PO' + + 'RTE, V.NUM_COPIAS, V.NUM_CORREOS, V.DATOS_BANCARIOS,'#10' V.ID_PE' + + 'DIDO, V.REFERENCIA_DEL_CLIENTE, V.ID_FACTURA_FINAL,'#10' F.DESCRI' + + 'PCION as FORMA_PAGO'#10' FROM'#10' V_FACTURAS_PROFORMA V'#10'LEFT JOIN F' + + 'ORMAS_PAGO F ON (F.ID = V.ID_FORMA_PAGO)'#10'WHERE V.ID = :ID'#10 StatementType = stSQL ColumnMappings = < item @@ -645,14 +45,18 @@ object RptFacturasProforma: TRptFacturasProforma DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' end - item - DatasetField = 'TIPO' - TableField = 'TIPO' - end item DatasetField = 'FECHA_FACTURA' TableField = 'FECHA_FACTURA' end + item + DatasetField = 'FECHA_VENCIMIENTO' + TableField = 'FECHA_VENCIMIENTO' + end + item + DatasetField = 'SITUACION' + TableField = 'SITUACION' + end item DatasetField = 'BASE_IMPONIBLE' TableField = 'BASE_IMPONIBLE' @@ -665,6 +69,10 @@ object RptFacturasProforma: TRptFacturasProforma DatasetField = 'IMPORTE_DESCUENTO' TableField = 'IMPORTE_DESCUENTO' end + item + DatasetField = 'DESCRIPCION_DESCUENTO' + TableField = 'DESCRIPCION_DESCUENTO' + end item DatasetField = 'IVA' TableField = 'IVA' @@ -689,159 +97,152 @@ object RptFacturasProforma: TRptFacturasProforma DatasetField = 'OBSERVACIONES' TableField = 'OBSERVACIONES' end - item - DatasetField = 'NIF_CIF' - TableField = 'NIF_CIF' - end item DatasetField = 'ID_CLIENTE' TableField = 'ID_CLIENTE' end + item + DatasetField = 'NIF_CIF' + TableField = 'NIF_CIF' + end item DatasetField = 'NOMBRE' TableField = 'NOMBRE' end item - DatasetField = 'CALLE' - TableField = 'CALLE' + DatasetField = 'ID_DIRECCION' + TableField = 'ID_DIRECCION' end item - DatasetField = 'PROVINCIA' - TableField = 'PROVINCIA' + DatasetField = 'CALLE' + TableField = 'CALLE' end item DatasetField = 'POBLACION' TableField = 'POBLACION' end + item + DatasetField = 'PROVINCIA' + TableField = 'PROVINCIA' + end item DatasetField = 'CODIGO_POSTAL' TableField = 'CODIGO_POSTAL' end + item + DatasetField = 'FECHA_ALTA' + TableField = 'FECHA_ALTA' + end + item + DatasetField = 'FECHA_MODIFICACION' + TableField = 'FECHA_MODIFICACION' + end + item + DatasetField = 'USUARIO' + TableField = 'USUARIO' + end + item + DatasetField = 'ID_FORMA_PAGO' + TableField = 'ID_FORMA_PAGO' + end + item + DatasetField = 'RECARGO_EQUIVALENCIA' + TableField = 'RECARGO_EQUIVALENCIA' + end + item + DatasetField = 'ID_TIPO_IVA' + TableField = 'ID_TIPO_IVA' + end + item + DatasetField = 'IMPORTE_NETO' + TableField = 'IMPORTE_NETO' + end + item + DatasetField = 'IMPORTE_PORTE' + TableField = 'IMPORTE_PORTE' + end + item + DatasetField = 'NUM_COPIAS' + TableField = 'NUM_COPIAS' + end + item + DatasetField = 'NUM_CORREOS' + TableField = 'NUM_CORREOS' + end + item + DatasetField = 'DATOS_BANCARIOS' + TableField = 'DATOS_BANCARIOS' + end + item + DatasetField = 'ID_PEDIDO' + TableField = 'ID_PEDIDO' + end + item + DatasetField = 'REFERENCIA_DEL_CLIENTE' + TableField = 'REFERENCIA_DEL_CLIENTE' + end + item + DatasetField = 'ID_FACTURA_FINAL' + TableField = 'ID_FACTURA_FINAL' + end item DatasetField = 'FORMA_PAGO' - TableField = 'FORMA_PAGO' - end - item - DatasetField = 'TITULAR' - TableField = 'TITULAR' - end - item - DatasetField = 'ENTIDAD' - TableField = 'ENTIDAD' - end - item - DatasetField = 'SUCURSAL' - TableField = 'SUCURSAL' - end - item - DatasetField = 'DC' - TableField = 'DC' - end - item - DatasetField = 'CUENTA' - TableField = 'CUENTA' - end - item - DatasetField = 'NIF_CIF_EMPRESA' - TableField = 'NIF_CIF_EMPRESA' - end - item - DatasetField = 'RAZON_SOCIAL' - TableField = 'RAZON_SOCIAL' - end - item - DatasetField = 'CALLE_EMPRESA' - TableField = 'CALLE_EMPRESA' - end - item - DatasetField = 'POBLACION_EMPRESA' - TableField = 'POBLACION_EMPRESA' - end - item - DatasetField = 'PROVINCIA_EMPRESA' - TableField = 'PROVINCIA_EMPRESA' - end - item - DatasetField = 'CODIGO_POSTAL_EMPRESA' - TableField = 'CODIGO_POSTAL_EMPRESA' - end - item - DatasetField = 'TELEFONO_1' - TableField = 'TELEFONO_1' - end - item - DatasetField = 'FAX' - TableField = 'FAX' - end - item - DatasetField = 'MOVIL_1' - TableField = 'MOVIL_1' - end - item - DatasetField = 'EMAIL_1' - TableField = 'EMAIL_1' - end - item - DatasetField = 'PAGINA_WEB' - TableField = 'PAGINA_WEB' - end - item - DatasetField = 'REGISTRO_MERCANTIL' - TableField = 'REGISTRO_MERCANTIL' - end - item - DatasetField = 'LOGOTIPO' - TableField = 'LOGOTIPO' + TableField = '' + SQLOrigin = 'FORMA_PAGO' end> end> - Name = 'InformeFacturasCliente' + Name = 'InformeFacturasProforma' Fields = < item Name = 'ID' DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID' - InPrimaryKey = True + end + item + Name = 'ID_EMPRESA' + DataType = datInteger end item Name = 'REFERENCIA' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_REFERENCIA' end item Name = 'FECHA_FACTURA' DataType = datDateTime - DictionaryEntry = 'FacturasCliente_FECHA_FACTURA' end item - Name = 'TIPO' + Name = 'FECHA_VENCIMIENTO' + DataType = datDateTime + end + item + Name = 'SITUACION' DataType = datString - Size = 1 + Size = 255 end item Name = 'BASE_IMPONIBLE' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_BASE_IMPONIBLE' end item Name = 'DESCUENTO' DataType = datFloat - DictionaryEntry = 'FacturasCliente_DESCUENTO' end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_DESCUENTO' + end + item + Name = 'DESCRIPCION_DESCUENTO' + DataType = datString + Size = 255 end item Name = 'IVA' DataType = datFloat - DictionaryEntry = 'FacturasCliente_IVA' end item Name = 'IMPORTE_IVA' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_IVA' end item Name = 'RE' @@ -854,152 +255,112 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'IMPORTE_TOTAL' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_TOTAL' end item Name = 'OBSERVACIONES' DataType = datMemo - DictionaryEntry = 'FacturasCliente_OBSERVACIONES' - end - item - Name = 'FORMA_PAGO' - DataType = datString - Size = 255 end item Name = 'ID_CLIENTE' DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID_CLIENTE' end item Name = 'NIF_CIF' DataType = datString Size = 15 - DictionaryEntry = 'FacturasCliente_NIF_CIF' end item Name = 'NOMBRE' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_NOMBRE' + end + item + Name = 'ID_DIRECCION' + DataType = datInteger end item Name = 'CALLE' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_CALLE' - end - item - Name = 'PROVINCIA' - DataType = datString - Size = 255 - DictionaryEntry = 'FacturasCliente_PROVINCIA' - end - item - Name = 'CODIGO_POSTAL' - DataType = datString - Size = 10 - DictionaryEntry = 'FacturasCliente_CODIGO_POSTAL' end item Name = 'POBLACION' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_POBLACION' end item - Name = 'TITULAR' + Name = 'PROVINCIA' DataType = datString Size = 255 end item - Name = 'ENTIDAD' - DataType = datString - Size = 15 - end - item - Name = 'SUCURSAL' - DataType = datString - Size = 15 - end - item - Name = 'DC' - DataType = datString - Size = 15 - end - item - Name = 'CUENTA' - DataType = datString - Size = 15 - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID_EMPRESA' - end - item - Name = 'NIF_CIF_EMPRESA' - DataType = datString - Size = 15 - end - item - Name = 'RAZON_SOCIAL' - DataType = datString - Size = 255 - end - item - Name = 'CALLE_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'POBLACION_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'PROVINCIA_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'CODIGO_POSTAL_EMPRESA' + Name = 'CODIGO_POSTAL' DataType = datString Size = 10 end item - Name = 'TELEFONO_1' - DataType = datString - Size = 25 + Name = 'FECHA_ALTA' + DataType = datDateTime end item - Name = 'FAX' - DataType = datString - Size = 25 + Name = 'FECHA_MODIFICACION' + DataType = datDateTime end item - Name = 'MOVIL_1' + Name = 'USUARIO' DataType = datString - Size = 25 + Size = 30 end item - Name = 'EMAIL_1' + Name = 'ID_FORMA_PAGO' + DataType = datInteger + end + item + Name = 'RECARGO_EQUIVALENCIA' + DataType = datSmallInt + end + item + Name = 'ID_TIPO_IVA' + DataType = datInteger + end + item + Name = 'IMPORTE_NETO' + DataType = datCurrency + end + item + Name = 'IMPORTE_PORTE' + DataType = datCurrency + end + item + Name = 'NUM_COPIAS' + DataType = datSmallInt + end + item + Name = 'NUM_CORREOS' + DataType = datSmallInt + end + item + Name = 'DATOS_BANCARIOS' DataType = datString Size = 255 end item - Name = 'PAGINA_WEB' + Name = 'ID_PEDIDO' + DataType = datInteger + end + item + Name = 'REFERENCIA_DEL_CLIENTE' DataType = datString Size = 255 end item - Name = 'REGISTRO_MERCANTIL' - DataType = datString - Size = 255 + Name = 'ID_FACTURA_FINAL' + DataType = datInteger end item - Name = 'LOGOTIPO' - DataType = datBlob + Name = 'FORMA_PAGO' + DataType = datString + Size = 255 end> ReadOnly = True end @@ -1008,20 +369,20 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'ID_FACTURA' DataType = datInteger - Value = '2' - ParamType = daptInput + Value = '' end> Statements = < item Connection = 'IBX' + TargetTable = 'FACTURAS_PROFORMA_DETALLES' SQL = 'SELECT'#10' DET.ID, DET.ID_FACTURA, DET.POSICION, DET.TIPO_DETALL' + 'E, ARTICULOS.REFERENCIA,'#10' DET.CONCEPTO, DET.CANTIDAD, DET.UNI' + 'DAD_MEDIDA, DET.IMPORTE_UNIDAD,'#10' DET.DESCUENTO, DET.IMPORTE_T' + - 'OTAL, DET.VISIBLE'#10'FROM FACTURAS_CLIENTE_DETALLES AS DET'#10'LEFT OUT' + - 'ER JOIN ARTICULOS ON (ARTICULOS.ID = DET.ID_ARTICULO)'#10'WHERE DET.' + - 'ID_FACTURA = :ID_FACTURA AND {Where}'#10'ORDER BY DET.ID_FACTURA, DE' + - 'T.POSICION;'#10#10#10 + 'OTAL, DET.VISIBLE'#10'FROM FACTURAS_PROFORMA_DETALLES AS DET'#10'LEFT OU' + + 'TER JOIN ARTICULOS ON (ARTICULOS.ID = DET.ID_ARTICULO)'#10'WHERE DET' + + '.ID_FACTURA = :ID_FACTURA AND {Where}'#10'ORDER BY DET.ID_FACTURA, D' + + 'ET.POSICION;'#10 StatementType = stSQL ColumnMappings = < item @@ -1073,7 +434,7 @@ object RptFacturasProforma: TRptFacturasProforma TableField = 'VISIBLE' end> end> - Name = 'InformeFacturasCliente_Detalles' + Name = 'InformeFacturasProforma_Detalles' Fields = < item Name = 'ID' @@ -1129,57 +490,12 @@ object RptFacturasProforma: TRptFacturasProforma DataType = datSmallInt end> end - item - Params = < - item - Name = 'ID_FACTURA' - Value = '' - ParamType = daptInput - end> - Statements = < - item - Connection = 'IBX' - SQL = - 'SELECT'#10' V_RECIBOS_CLIENTE.ID_FACTURA, V_RECIBOS_CLIENTE.FECHA' + - '_VENCIMIENTO, V_RECIBOS_CLIENTE.IMPORTE_TOTAL'#10'FROM V_RECIBOS_CLI' + - 'ENTE'#10'WHERE V_RECIBOS_CLIENTE.ID_FACTURA = :ID_FACTURA'#10'ORDER BY V' + - '_RECIBOS_CLIENTE.FECHA_VENCIMIENTO'#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_FACTURA' - TableField = 'ID_FACTURA' - end - item - DatasetField = 'FECHA_VENCIMIENTO' - TableField = 'FECHA_VENCIMIENTO' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end> - end> - Name = 'InformeFacturasCliente_Vencimientos' - Fields = < - item - Name = 'ID_FACTURA' - DataType = datInteger - end - item - Name = 'FECHA_VENCIMIENTO' - DataType = datDateTime - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end> - end item Params = <> Statements = < item Connection = 'IBX' - TargetTable = 'V_FACTURAS_CLIENTE' + TargetTable = 'V_FACTURAS_PROFORMA' SQL = 'select ID_EMPRESA,'#10'extract (year from fecha_factura) as ANO,'#10'ext' + 'ract (month from fecha_factura) as MES,'#10'case'#10'when extract (month' + @@ -1203,8 +519,8 @@ object RptFacturasProforma: TRptFacturasProforma 'fecha_factura) = 12 then '#39'DICIEMBRE - '#39' || extract (year from fe' + 'cha_factura)'#10'end as TITULO,'#10'REFERENCIA, ID_CLIENTE, NOMBRE, SIT' + 'UACION, NIF_CIF, FECHA_FACTURA, fecha_vencimiento, BASE_IMPONIBL' + - 'E, IMPORTE_IVA, IMPORTE_TOTAL'#10#10'from V_facturas_cliente'#10'where {wh' + - 'ere}'#10'order by ANO, MES, FECHA_FACTURA, NOMBRE'#10#10 + 'E, IMPORTE_IVA, IMPORTE_TOTAL'#10#10'from V_facturas_proforma'#10'where {w' + + 'here}'#10'order by ANO, MES, FECHA_FACTURA, NOMBRE'#10#10 StatementType = stSQL ColumnMappings = < item @@ -1267,7 +583,7 @@ object RptFacturasProforma: TRptFacturasProforma TableField = 'FECHA_VENCIMIENTO' end> end> - Name = 'InformeListadoFacturas' + Name = 'InformeListadoFacturasProforma' Fields = < item Name = 'ID_EMPRESA' @@ -1303,7 +619,7 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'SITUACION' DataType = datString - Size = 19 + Size = 255 end item Name = 'NIF_CIF' @@ -1330,1848 +646,6 @@ object RptFacturasProforma: TRptFacturasProforma Name = 'IMPORTE_TOTAL' DataType = datCurrency end> - end - item - Params = <> - Statements = < - item - Connection = 'IBX' - TargetTable = 'V_FACTURAS_CLIENTE' - SQL = - 'select ID_EMPRESA,'#10'extract (year from fecha_vencimiento) as ANO,' + - #10'extract (month from fecha_vencimiento) as MES,'#10'case'#10'when extrac' + - 't (month from fecha_vencimiento) = 1 then '#39'ENERO - '#39' || extract ' + - '(year from fecha_vencimiento)'#10'when extract (month from fecha_ven' + - 'cimiento) = 2 then '#39'FEBRERO - '#39' || extract (year from fecha_venc' + - 'imiento)'#10'when extract (month from fecha_vencimiento) = 3 then '#39'M' + - 'ARZO - '#39' || extract (year from fecha_vencimiento)'#10'when extract (' + - 'month from fecha_vencimiento) = 4 then '#39'ABRIL - '#39' || extract (ye' + - 'ar from fecha_vencimiento)'#10'when extract (month from fecha_vencim' + - 'iento) = 5 then '#39'MAYO - '#39' || extract (year from fecha_vencimient' + - 'o)'#10'when extract (month from fecha_vencimiento) = 6 then '#39'JUNIO -' + - ' '#39' || extract (year from fecha_vencimiento)'#10'when extract (month ' + - 'from fecha_vencimiento) = 7 then '#39'JULIO - '#39' || extract (year fro' + - 'm fecha_vencimiento)'#10'when extract (month from fecha_vencimiento)' + - ' = 8 then '#39'AGOSTO - '#39' || extract (year from fecha_vencimiento)'#10'w' + - 'hen extract (month from fecha_vencimiento) = 9 then '#39'SEPTIEMBRE ' + - '- '#39' || extract (year from fecha_vencimiento)'#10'when extract (month' + - ' from fecha_vencimiento) = 10 then '#39'OCTUBRE - '#39' || extract (year' + - ' from fecha_vencimiento)'#10'when extract (month from fecha_vencimie' + - 'nto) = 11 then '#39'NOVIEMBRE - '#39' || extract (year from fecha_vencim' + - 'iento)'#10'when extract (month from fecha_vencimiento) = 12 then '#39'DI' + - 'CIEMBRE - '#39' || extract (year from fecha_vencimiento)'#10'end as TITU' + - 'LO,'#10'REFERENCIA, ID_CLIENTE, NOMBRE, SITUACION, NIF_CIF, fecha_f' + - 'actura, fecha_vencimiento, BASE_IMPONIBLE, IMPORTE_IVA, IMPORTE_' + - 'TOTAL'#10#10'from V_facturas_cliente'#10'where {where}'#10'order by ANO, MES, ' + - 'fecha_vencimiento, NOMBRE'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_EMPRESA' - TableField = 'ID_EMPRESA' - end - item - DatasetField = 'ANO' - TableField = '' - SQLOrigin = 'ANO' - end - item - DatasetField = 'MES' - TableField = '' - SQLOrigin = 'MES' - end - item - DatasetField = 'TITULO' - TableField = '' - SQLOrigin = 'TITULO' - end - item - DatasetField = 'REFERENCIA' - TableField = 'REFERENCIA' - end - item - DatasetField = 'ID_CLIENTE' - TableField = 'ID_CLIENTE' - end - item - DatasetField = 'NOMBRE' - TableField = 'NOMBRE' - end - item - DatasetField = 'SITUACION' - TableField = 'SITUACION' - end - item - DatasetField = 'NIF_CIF' - TableField = 'NIF_CIF' - end - item - DatasetField = 'FECHA_FACTURA' - TableField = 'FECHA_FACTURA' - end - item - DatasetField = 'FECHA_VENCIMIENTO' - TableField = 'FECHA_VENCIMIENTO' - end - item - DatasetField = 'BASE_IMPONIBLE' - TableField = 'BASE_IMPONIBLE' - end - item - DatasetField = 'IMPORTE_IVA' - TableField = 'IMPORTE_IVA' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end> - end> - Name = 'InformeListadoFacturasPendientes' - Fields = < - item - Name = 'ID_EMPRESA' - DataType = datInteger - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'MES' - DataType = datSmallInt - end - item - Name = 'TITULO' - DataType = datString - Size = 19 - end - item - Name = 'REFERENCIA' - DataType = datString - Size = 255 - end - item - Name = 'ID_CLIENTE' - DataType = datInteger - end - item - Name = 'NOMBRE' - DataType = datString - Size = 255 - end - item - Name = 'SITUACION' - DataType = datString - Size = 19 - end - item - Name = 'NIF_CIF' - DataType = datString - Size = 15 - end - item - Name = 'FECHA_FACTURA' - DataType = datDateTime - end - item - Name = 'FECHA_VENCIMIENTO' - DataType = datDateTime - end - item - Name = 'BASE_IMPONIBLE' - DataType = datCurrency - end - item - Name = 'IMPORTE_IVA' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end> - end - item - Params = <> - Statements = < - item - Connection = 'IBX' - TargetTable = 'V_FACTURAS_CLIENTE' - SQL = - 'select ID_EMPRESA,'#10'extract (year from fecha_factura) as ANO,'#10'ext' + - 'ract (month from fecha_factura) as MES,'#10'case'#10'when extract (month' + - ' from fecha_factura) = 1 then '#39'ENERO - '#39' || extract (year from f' + - 'echa_factura)'#10'when extract (month from fecha_factura) = 2 then '#39 + - 'FEBRERO - '#39' || extract (year from fecha_factura)'#10'when extract (m' + - 'onth from fecha_factura) = 3 then '#39'MARZO - '#39' || extract (year fr' + - 'om fecha_factura)'#10'when extract (month from fecha_factura) = 4 th' + - 'en '#39'ABRIL - '#39' || extract (year from fecha_factura)'#10'when extract ' + - '(month from fecha_factura) = 5 then '#39'MAYO - '#39' || extract (year f' + - 'rom fecha_factura)'#10'when extract (month from fecha_factura) = 6 t' + - 'hen '#39'JUNIO - '#39' || extract (year from fecha_factura)'#10'when extract' + - ' (month from fecha_factura) = 7 then '#39'JULIO - '#39' || extract (year' + - ' from fecha_factura)'#10'when extract (month from fecha_factura) = 8' + - ' then '#39'AGOSTO - '#39' || extract (year from fecha_factura)'#10'when extr' + - 'act (month from fecha_factura) = 9 then '#39'SEPTIEMBRE - '#39' || extra' + - 'ct (year from fecha_factura)'#10'when extract (month from fecha_fact' + - 'ura) = 10 then '#39'OCTUBRE - '#39' || extract (year from fecha_factura)' + - #10'when extract (month from fecha_factura) = 11 then '#39'NOVIEMBRE - ' + - #39' || extract (year from fecha_factura)'#10'when extract (month from ' + - 'fecha_factura) = 12 then '#39'DICIEMBRE - '#39' || extract (year from fe' + - 'cha_factura)'#10'end as TITULO,'#10'sum(BASE_IMPONIBLE) as BASE_IMPONIBL' + - 'E,'#10'sum(IMPORTE_IVA) as IMPORTE_IVA,'#10'sum(IMPORTE_TOTAL) AS IMPORT' + - 'E_TOTAL'#10'from V_facturas_cliente'#10'group by 1,2,3,4'#10'order by 1,2,3,' + - '4'#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_EMPRESA' - TableField = 'ID_EMPRESA' - end - item - DatasetField = 'ANO' - TableField = '' - SQLOrigin = 'ANO' - end - item - DatasetField = 'MES' - TableField = '' - SQLOrigin = 'MES' - end - item - DatasetField = 'TITULO' - TableField = '' - SQLOrigin = 'TITULO' - end - item - DatasetField = 'BASE_IMPONIBLE' - TableField = 'BASE_IMPONIBLE' - end - item - DatasetField = 'IMPORTE_IVA' - TableField = 'IMPORTE_IVA' - end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end> - end> - Name = 'InformeListadoFacturasResumen' - Fields = < - item - Name = 'ID_EMPRESA' - DataType = datInteger - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'MES' - DataType = datSmallInt - end - item - Name = 'TITULO' - DataType = datString - Size = 19 - end - item - Name = 'BASE_IMPONIBLE' - DataType = datCurrency - end - item - Name = 'IMPORTE_IVA' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA' - Value = '' - end - item - Name = 'ANO' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end - item - Name = 'NTOP' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - SQL = - 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + - ', sum (IMPORTE_TOTAL_ANO) as IMPORTE_TOTAL_ANO,'#10'sum (IMPORTE_TOT' + - 'AL_ANO1) as IMPORTE_TOTAL_ANO1, sum (IMPORTE_TOTAL_ANO2) as IMPO' + - 'RTE_TOTAL_ANO2,'#10'sum (PORCENTAJE) as PORCENTAJE'#10'from'#10'('#10'select C.R' + - 'EFERENCIA as REFERENCIA, COALESCE(C.NOMBRE, '#39'Agente no asignado'#39 + - ') as NOMBRE, P.ANO as ANO1, 0 as ANO2,'#10'p.IMPORTE_TOTAL_ANO, SUM(' + - 'P.IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO1, 0 as IMPORTE_TOTAL_ANO2,' + - #10' ((SUM(P.IMPORTE_TOTAL)*100)/p.IMPORTE_TOTAL_ANO) as PORCENTAJE' + - #10#10'from V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C on P.ID_AGE' + - 'NTE = C.ID'#10'left join AGENTES_DATOS AD on P.ID_AGENTE = AD.ID_AGE' + - 'NTE'#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO = :ANO'#10'and AD.FEC' + - 'HA_BAJA is null'#10'group by 1,2,3,4,5'#10#10'union'#10#10'select C2.REFERENCIA ' + - 'as REFERENCIA, COALESCE(C2.NOMBRE, '#39'Agente no asignado'#39') as NOMB' + - 'RE, 0 as ANO1, P2.ANO as ANO2,'#10' 0 as IMPORTE_TOTAL_ANO, 0 as IMP' + - 'ORTE_TOTAL_ANO1, SUM(P2.IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO2,'#10' 0' + - ' as PORCENTAJE'#10'from V_INF_FAC_DET_CLIENTE P2'#10'left join CONTACTOS' + - ' C2 on P2.ID_AGENTE = C2.ID'#10'left join AGENTES_DATOS AD2 on P2.ID' + - '_AGENTE = AD2.ID_AGENTE'#10'where p2.ID_EMPRESA = :ID_EMPRESA'#10'and P2' + - '.ANO = :ANO2'#10'and AD2.FECHA_BAJA is null'#10'group by 1,2,3,4,5,6'#10')'#10#10 + - 'group by 1,2'#10'having (sum(ANO1) > 0)'#10'order by 3,6 desc'#10'rows 1 to ' + - ':NTOP'#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'REFERENCIA' - TableField = 'REFERENCIA' - end - item - DatasetField = 'NOMBRE' - TableField = 'NOMBRE' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO' - TableField = 'IMPORTE_TOTAL_ANO' - end - item - DatasetField = 'PORCENTAJE' - TableField = 'PORCENTAJE' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO1' - TableField = 'IMPORTE_TOTAL_ANO1' - end - item - DatasetField = 'IMPORTE_TOTAL_ANO2' - TableField = 'IMPORTE_TOTAL_ANO2' - end> - end> - Name = 'InformeListadoAgentesMayorFacturacionResumen' - Fields = < - item - Name = 'REFERENCIA' - DataType = datString - Size = 255 - end - item - Name = 'NOMBRE' - DataType = datString - Size = 255 - end - item - Name = 'ANO1' - DataType = datLargeInt - end - item - Name = 'ANO2' - DataType = datLargeInt - end - item - Name = 'IMPORTE_TOTAL_ANO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_ANO1' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_ANO2' - DataType = datCurrency - end - item - Name = 'PORCENTAJE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - SQL = - 'select VALOR, DESCRIPCION,'#10'periodo_ingresos1.ANO as Ano1, period' + - 'o_ingresos1.IMPORTE_TOTAL as INGRESOS_ANO1,'#10'periodo_gastos1.ANO ' + - 'as Ano1, periodo_gastos1.IMPORTE_TOTAL as GASTOS_ANO1,'#10'(coalesce' + - '(periodo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.' + - 'IMPORTE_TOTAL, 0)) as BENEFICIO_ANO1,'#10'case'#10'when (periodo_ingreso' + - 's1.IMPORTE_TOTAL = 0) then (100 - ((coalesce(periodo_ingresos1.I' + - 'MPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0))*1' + - '00))'#10'else ((((coalesce(periodo_ingresos1.IMPORTE_TOTAL, 0) - coa' + - 'lesce(periodo_gastos1.IMPORTE_TOTAL, 0))*100)/periodo_ingresos1.' + - 'IMPORTE_TOTAL))'#10'end as Porcentaje_Beneficios_Ano1,'#10#10'periodo_ingr' + - 'esos2.ANO as Ano2, periodo_ingresos2.IMPORTE_TOTAL as INGRESOS_A' + - 'NO2,'#10'periodo_gastos2.ANO as Ano2, periodo_gastos2.IMPORTE_TOTAL ' + - 'as GASTOS_ANO2,'#10'(coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)) as BENEFICIO_ANO2,'#10'c' + - 'ase'#10'when (periodo_ingresos2.IMPORTE_TOTAL = 0) then (100 - ((coa' + - 'lesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gas' + - 'tos2.IMPORTE_TOTAL, 0))*100))'#10'else ((((coalesce(periodo_ingresos' + - '2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)' + - ')*100)/periodo_ingresos2.IMPORTE_TOTAL))'#10'end as Porcentaje_Benef' + - 'icios_Ano2,'#10#10'(periodo_ingresos1.IMPORTE_TOTAL - periodo_ingresos' + - '2.IMPORTE_TOTAL) as Diferencia_Ingresos,'#10'case'#10'when (periodo_ingr' + - 'esos2.IMPORTE_TOTAL = 0) then (100 - ((periodo_ingresos1.IMPORTE' + - '_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_' + - 'ingresos1.IMPORTE_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100)/' + - 'periodo_ingresos2.IMPORTE_TOTAL)'#10'end as Porcentaje_Aumento_Ingre' + - 'sos,'#10#10'(periodo_gastos1.IMPORTE_TOTAL - periodo_gastos2.IMPORTE_T' + - 'OTAL) as Diferencia_Gastos,'#10'case'#10'when (periodo_gastos2.IMPORTE_T' + - 'OTAL = 0) then (100 - ((periodo_gastos1.IMPORTE_TOTAL - periodo_' + - 'gastos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_gastos1.IMPORTE_TOT' + - 'AL - periodo_gastos2.IMPORTE_TOTAL)*100)/periodo_gastos2.IMPORTE' + - '_TOTAL)'#10'end as Porcentaje_Aumento_Gastos,'#10#10'case when periodo_ing' + - 'resos2.ANO is null then 0'#10'else'#10'((coalesce(periodo_ingresos1.IMPO' + - 'RTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0)) - (c' + - 'oalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_g' + - 'astos2.IMPORTE_TOTAL, 0)))'#10'end as Diferencia_Beneficios,'#10#10'case w' + - 'hen periodo_ingresos2.ANO is null then 0'#10'else'#10'case'#10'when ((coales' + - 'ce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos' + - '2.IMPORTE_TOTAL, 0)) = 0) then (100 - (((coalesce(periodo_ingres' + - 'os1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, ' + - '0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(p' + - 'eriodo_gastos2.IMPORTE_TOTAL, 0)))*100))'#10'else (((((coalesce(peri' + - 'odo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPOR' + - 'TE_TOTAL, 0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)))*100) / (coalesce(pe' + - 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + - 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10'FROM' + - #10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, MES' + - ' as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF' + - '_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (ANO = :A' + - 'NO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos1 on ' + - '(VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2.ID_EM' + - 'PRESA, comp2.ANO, MES as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMP' + - 'ORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID' + - '_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc' + - ') periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10#10'left join'#10 + - '(select comp3.ID_EMPRESA, comp3.ANO, MES as NFILA, SUM(comp3.BAS' + - 'E_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLIENTE comp3'#10'where' + - ' ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'orde' + - 'r by 1 desc,2 asc) periodo_ingresos2 on (VALOR = periodo_ingreso' + - 's2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, comp4.ANO, MES as' + - ' NFILA, SUM(comp4.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FA' + - 'C_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :AN' + - 'O2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_gastos2 on (VA' + - 'LOR = periodo_gastos2.NFILA)'#10#10#10'where periodo= '#39'MENSUAL'#39#10'order by' + - ' valor asc'#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'INGRESOS_ANO1' - TableField = 'INGRESOS_ANO1' - end - item - DatasetField = 'ANO11' - TableField = 'ANO11' - end - item - DatasetField = 'GASTOS_ANO1' - TableField = 'GASTOS_ANO1' - end - item - DatasetField = 'BENEFICIO_ANO1' - TableField = 'BENEFICIO_ANO1' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO1' - TableField = 'PORCENTAJE_BENEFICIOS_ANO1' - end - item - DatasetField = 'INGRESOS_ANO2' - TableField = 'INGRESOS_ANO2' - end - item - DatasetField = 'ANO21' - TableField = 'ANO21' - end - item - DatasetField = 'GASTOS_ANO2' - TableField = 'GASTOS_ANO2' - end - item - DatasetField = 'BENEFICIO_ANO2' - TableField = 'BENEFICIO_ANO2' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO2' - TableField = 'PORCENTAJE_BENEFICIOS_ANO2' - end - item - DatasetField = 'DIFERENCIA_INGRESOS' - TableField = 'DIFERENCIA_INGRESOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_INGRESOS' - TableField = 'PORCENTAJE_AUMENTO_INGRESOS' - end - item - DatasetField = 'DIFERENCIA_GASTOS' - TableField = 'DIFERENCIA_GASTOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_GASTOS' - TableField = 'PORCENTAJE_AUMENTO_GASTOS' - end - item - DatasetField = 'DIFERENCIA_BENEFICIOS' - TableField = 'DIFERENCIA_BENEFICIOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - TableField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - end> - end> - Name = 'InformeListadoBeneficiosGrafCompMensual' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO11' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO1' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO1' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO2' - DataType = datCurrency - end - item - Name = 'ANO21' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO2' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO2' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO2' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_INGRESOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_INGRESOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_GASTOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_GASTOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_BENEFICIOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_BENEFICIOS' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - SQL = - 'select VALOR, DESCRIPCION,'#10'periodo_ingresos1.ANO as Ano1, period' + - 'o_ingresos1.IMPORTE_TOTAL as INGRESOS_ANO1,'#10'periodo_gastos1.ANO ' + - 'as Ano1, periodo_gastos1.IMPORTE_TOTAL as GASTOS_ANO1,'#10'(coalesce' + - '(periodo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.' + - 'IMPORTE_TOTAL, 0)) as BENEFICIO_ANO1,'#10'case'#10'when (periodo_ingreso' + - 's1.IMPORTE_TOTAL = 0) then (100 - ((coalesce(periodo_ingresos1.I' + - 'MPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0))*1' + - '00))'#10'else ((((coalesce(periodo_ingresos1.IMPORTE_TOTAL, 0) - coa' + - 'lesce(periodo_gastos1.IMPORTE_TOTAL, 0))*100)/periodo_ingresos1.' + - 'IMPORTE_TOTAL))'#10'end as Porcentaje_Beneficios_Ano1,'#10#10'periodo_ingr' + - 'esos2.ANO as Ano2, periodo_ingresos2.IMPORTE_TOTAL as INGRESOS_A' + - 'NO2,'#10'periodo_gastos2.ANO as Ano2, periodo_gastos2.IMPORTE_TOTAL ' + - 'as GASTOS_ANO2,'#10'(coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)) as BENEFICIO_ANO2,'#10'c' + - 'ase'#10'when (periodo_ingresos2.IMPORTE_TOTAL = 0) then (100 - ((coa' + - 'lesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gas' + - 'tos2.IMPORTE_TOTAL, 0))*100))'#10'else ((((coalesce(periodo_ingresos' + - '2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)' + - ')*100)/periodo_ingresos2.IMPORTE_TOTAL))'#10'end as Porcentaje_Benef' + - 'icios_Ano2,'#10#10'(periodo_ingresos1.IMPORTE_TOTAL - periodo_ingresos' + - '2.IMPORTE_TOTAL) as Diferencia_Ingresos,'#10'case'#10'when (periodo_ingr' + - 'esos2.IMPORTE_TOTAL = 0) then (100 - ((periodo_ingresos1.IMPORTE' + - '_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_' + - 'ingresos1.IMPORTE_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100)/' + - 'periodo_ingresos2.IMPORTE_TOTAL)'#10'end as Porcentaje_Aumento_Ingre' + - 'sos,'#10#10'(periodo_gastos1.IMPORTE_TOTAL - periodo_gastos2.IMPORTE_T' + - 'OTAL) as Diferencia_Gastos,'#10'case'#10'when (periodo_gastos2.IMPORTE_T' + - 'OTAL = 0) then (100 - ((periodo_gastos1.IMPORTE_TOTAL - periodo_' + - 'gastos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_gastos1.IMPORTE_TOT' + - 'AL - periodo_gastos2.IMPORTE_TOTAL)*100)/periodo_gastos2.IMPORTE' + - '_TOTAL)'#10'end as Porcentaje_Aumento_Gastos,'#10#10'case when periodo_ing' + - 'resos2.ANO is null then 0'#10'else'#10'((coalesce(periodo_ingresos1.IMPO' + - 'RTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0)) - (c' + - 'oalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_g' + - 'astos2.IMPORTE_TOTAL, 0)))'#10'end as Diferencia_Beneficios,'#10#10'case w' + - 'hen periodo_ingresos2.ANO is null then 0'#10'else'#10'case'#10'when ((coales' + - 'ce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos' + - '2.IMPORTE_TOTAL, 0)) = 0) then (100 - (((coalesce(periodo_ingres' + - 'os1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, ' + - '0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(p' + - 'eriodo_gastos2.IMPORTE_TOTAL, 0)))*100))'#10'else (((((coalesce(peri' + - 'odo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPOR' + - 'TE_TOTAL, 0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)))*100) / (coalesce(pe' + - 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + - 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10#10'FRO' + - 'M'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, TR' + - 'IMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'fro' + - 'm V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (A' + - 'NO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingres' + - 'os1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp' + - '2.ID_EMPRESA, comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.BASE_IMPO' + - 'NIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_' + - 'EMPRESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by' + - ' 1 desc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA' + - ')'#10#10'left join'#10'(select comp3.ID_EMPRESA, comp3.ANO, TRIMESTRE as N' + - 'FILA, SUM(comp3.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_' + - 'CLIENTE comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10 + - 'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALO' + - 'R = periodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA' + - ', comp4.ANO, TRIMESTRE as NFILA, SUM(comp4.BASE_IMPONIBLE) as IM' + - 'PORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :I' + - 'D_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 as' + - 'c) periodo_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where pe' + - 'riodo= '#39'TRIMESTRAL'#39#10'order by valor asc'#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'INGRESOS_ANO1' - TableField = 'INGRESOS_ANO1' - end - item - DatasetField = 'ANO11' - TableField = 'ANO11' - end - item - DatasetField = 'GASTOS_ANO1' - TableField = 'GASTOS_ANO1' - end - item - DatasetField = 'BENEFICIO_ANO1' - TableField = 'BENEFICIO_ANO1' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO1' - TableField = 'PORCENTAJE_BENEFICIOS_ANO1' - end - item - DatasetField = 'INGRESOS_ANO2' - TableField = 'INGRESOS_ANO2' - end - item - DatasetField = 'ANO21' - TableField = 'ANO21' - end - item - DatasetField = 'GASTOS_ANO2' - TableField = 'GASTOS_ANO2' - end - item - DatasetField = 'BENEFICIO_ANO2' - TableField = 'BENEFICIO_ANO2' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO2' - TableField = 'PORCENTAJE_BENEFICIOS_ANO2' - end - item - DatasetField = 'DIFERENCIA_INGRESOS' - TableField = 'DIFERENCIA_INGRESOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_INGRESOS' - TableField = 'PORCENTAJE_AUMENTO_INGRESOS' - end - item - DatasetField = 'DIFERENCIA_GASTOS' - TableField = 'DIFERENCIA_GASTOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_GASTOS' - TableField = 'PORCENTAJE_AUMENTO_GASTOS' - end - item - DatasetField = 'DIFERENCIA_BENEFICIOS' - TableField = 'DIFERENCIA_BENEFICIOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - TableField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - end> - end> - Name = 'InformeListadoBeneficiosGrafCompTrimestral' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO11' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO1' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO1' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO2' - DataType = datCurrency - end - item - Name = 'ANO21' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO2' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO2' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO2' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_INGRESOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_INGRESOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_GASTOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_GASTOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_BENEFICIOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_BENEFICIOS' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ID_EMPRESA1' - Value = '' - end - item - Name = 'ANO1' - Value = '' - end - item - Name = 'ID_EMPRESA2' - Value = '' - end - item - Name = 'ANO2' - Value = '' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - SQL = - 'select VALOR, DESCRIPCION,'#10'periodo_ingresos1.ANO as Ano1, period' + - 'o_ingresos1.IMPORTE_TOTAL as INGRESOS_ANO1,'#10'periodo_gastos1.ANO ' + - 'as Ano1, periodo_gastos1.IMPORTE_TOTAL as GASTOS_ANO1,'#10'(coalesce' + - '(periodo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.' + - 'IMPORTE_TOTAL, 0)) as BENEFICIO_ANO1,'#10'case'#10'when (periodo_ingreso' + - 's1.IMPORTE_TOTAL = 0) then (100 - ((coalesce(periodo_ingresos1.I' + - 'MPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0))*1' + - '00))'#10'else ((((coalesce(periodo_ingresos1.IMPORTE_TOTAL, 0) - coa' + - 'lesce(periodo_gastos1.IMPORTE_TOTAL, 0))*100)/periodo_ingresos1.' + - 'IMPORTE_TOTAL))'#10'end as Porcentaje_Beneficios_Ano1,'#10#10'periodo_ingr' + - 'esos2.ANO as Ano2, periodo_ingresos2.IMPORTE_TOTAL as INGRESOS_A' + - 'NO2,'#10'periodo_gastos2.ANO as Ano2, periodo_gastos2.IMPORTE_TOTAL ' + - 'as GASTOS_ANO2,'#10'(coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)) as BENEFICIO_ANO2,'#10'c' + - 'ase'#10'when (periodo_ingresos2.IMPORTE_TOTAL = 0) then (100 - ((coa' + - 'lesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gas' + - 'tos2.IMPORTE_TOTAL, 0))*100))'#10'else ((((coalesce(periodo_ingresos' + - '2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)' + - ')*100)/periodo_ingresos2.IMPORTE_TOTAL))'#10'end as Porcentaje_Benef' + - 'icios_Ano2,'#10#10'(periodo_ingresos1.IMPORTE_TOTAL - periodo_ingresos' + - '2.IMPORTE_TOTAL) as Diferencia_Ingresos,'#10'case'#10'when (periodo_ingr' + - 'esos2.IMPORTE_TOTAL = 0) then (100 - ((periodo_ingresos1.IMPORTE' + - '_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_' + - 'ingresos1.IMPORTE_TOTAL - periodo_ingresos2.IMPORTE_TOTAL)*100)/' + - 'periodo_ingresos2.IMPORTE_TOTAL)'#10'end as Porcentaje_Aumento_Ingre' + - 'sos,'#10#10'(periodo_gastos1.IMPORTE_TOTAL - periodo_gastos2.IMPORTE_T' + - 'OTAL) as Diferencia_Gastos,'#10'case'#10'when (periodo_gastos2.IMPORTE_T' + - 'OTAL = 0) then (100 - ((periodo_gastos1.IMPORTE_TOTAL - periodo_' + - 'gastos2.IMPORTE_TOTAL)*100))'#10'else (((periodo_gastos1.IMPORTE_TOT' + - 'AL - periodo_gastos2.IMPORTE_TOTAL)*100)/periodo_gastos2.IMPORTE' + - '_TOTAL)'#10'end as Porcentaje_Aumento_Gastos,'#10#10'case when periodo_ing' + - 'resos2.ANO is null then 0'#10'else'#10'((coalesce(periodo_ingresos1.IMPO' + - 'RTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, 0)) - (c' + - 'oalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_g' + - 'astos2.IMPORTE_TOTAL, 0)))'#10'end as Diferencia_Beneficios,'#10#10'case w' + - 'hen periodo_ingresos2.ANO is null then 0'#10'else'#10'case'#10'when ((coales' + - 'ce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos' + - '2.IMPORTE_TOTAL, 0)) = 0) then (100 - (((coalesce(periodo_ingres' + - 'os1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPORTE_TOTAL, ' + - '0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(p' + - 'eriodo_gastos2.IMPORTE_TOTAL, 0)))*100))'#10'else (((((coalesce(peri' + - 'odo_ingresos1.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos1.IMPOR' + - 'TE_TOTAL, 0)) - (coalesce(periodo_ingresos2.IMPORTE_TOTAL, 0) - ' + - 'coalesce(periodo_gastos2.IMPORTE_TOTAL, 0)))*100) / (coalesce(pe' + - 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + - 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10#10'FRO' + - 'M'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, SE' + - 'MESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from' + - ' V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (AN' + - 'O = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingreso' + - 's1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2' + - '.ID_EMPRESA, comp2.ANO, SEMESTRE as NFILA, SUM(comp2.BASE_IMPONI' + - 'BLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EM' + - 'PRESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1' + - ' desc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10 + - #10'left join'#10'(select comp3.ID_EMPRESA, comp3.ANO, SEMESTRE as NFIL' + - 'A, SUM(comp3.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLI' + - 'ENTE comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'gro' + - 'up by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALOR =' + - ' periodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, c' + - 'omp4.ANO, SEMESTRE as NFILA, SUM(comp4.BASE_IMPONIBLE) as IMPORT' + - 'E_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EM' + - 'PRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) p' + - 'eriodo_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where period' + - 'o= '#39'SEMESTRAL'#39#10'order by valor asc'#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'VALOR' - TableField = 'VALOR' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'ANO1' - TableField = 'ANO1' - end - item - DatasetField = 'ANO2' - TableField = 'ANO2' - end - item - DatasetField = 'INGRESOS_ANO1' - TableField = 'INGRESOS_ANO1' - end - item - DatasetField = 'ANO11' - TableField = 'ANO11' - end - item - DatasetField = 'GASTOS_ANO1' - TableField = 'GASTOS_ANO1' - end - item - DatasetField = 'BENEFICIO_ANO1' - TableField = 'BENEFICIO_ANO1' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO1' - TableField = 'PORCENTAJE_BENEFICIOS_ANO1' - end - item - DatasetField = 'INGRESOS_ANO2' - TableField = 'INGRESOS_ANO2' - end - item - DatasetField = 'ANO21' - TableField = 'ANO21' - end - item - DatasetField = 'GASTOS_ANO2' - TableField = 'GASTOS_ANO2' - end - item - DatasetField = 'BENEFICIO_ANO2' - TableField = 'BENEFICIO_ANO2' - end - item - DatasetField = 'PORCENTAJE_BENEFICIOS_ANO2' - TableField = 'PORCENTAJE_BENEFICIOS_ANO2' - end - item - DatasetField = 'DIFERENCIA_INGRESOS' - TableField = 'DIFERENCIA_INGRESOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_INGRESOS' - TableField = 'PORCENTAJE_AUMENTO_INGRESOS' - end - item - DatasetField = 'DIFERENCIA_GASTOS' - TableField = 'DIFERENCIA_GASTOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_GASTOS' - TableField = 'PORCENTAJE_AUMENTO_GASTOS' - end - item - DatasetField = 'DIFERENCIA_BENEFICIOS' - TableField = 'DIFERENCIA_BENEFICIOS' - end - item - DatasetField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - TableField = 'PORCENTAJE_AUMENTO_BENEFICIOS' - end> - end> - Name = 'InformeListadoBeneficiosGrafCompSemestral' - Fields = < - item - Name = 'VALOR' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ANO1' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO11' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO1' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO1' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO1' - DataType = datCurrency - end - item - Name = 'ANO2' - DataType = datSmallInt - end - item - Name = 'INGRESOS_ANO2' - DataType = datCurrency - end - item - Name = 'ANO21' - DataType = datSmallInt - end - item - Name = 'GASTOS_ANO2' - DataType = datCurrency - end - item - Name = 'BENEFICIO_ANO2' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_BENEFICIOS_ANO2' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_INGRESOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_INGRESOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_GASTOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_GASTOS' - DataType = datCurrency - end - item - Name = 'DIFERENCIA_BENEFICIOS' - DataType = datCurrency - end - item - Name = 'PORCENTAJE_AUMENTO_BENEFICIOS' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select SEN.ID_AGENTE, COALESCE(C.NOMBRE, '#39'SIN ASIGNAR'#39') || '#39' ('#39' ' + - '|| CLIENTES_TOTALES.NUM_CLIENTES_TOTALES || '#39')'#39' as AGENTE, ANO, ' + - 'MES,'#10' P.descripcion,'#10#10' sum(ALTAS_CLIENTE) as ALTAS_CLIENTE' + - ','#10#10' sum(CLIENTES_ACTIVOS) as CLIENTES_TOTALES,'#10#10' sum(CANTI' + - 'DAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum(IMPORTE_OBJETIVO) as IMP' + - 'ORTE_OBJETIVO,'#10#10' sum(CANTIDAD_CONSEGUIDA) as CANTIDAD_CONSEGU' + - 'IDA, sum(CANTIDAD_DEVUELTA) as CANTIDAD_DEVUELTA, sum(CANTIDAD_T' + - 'OTAL_CONSEGUIDA) as CANTIDAD_TOTAL_CONSEGUIDA,'#10' sum(IMPORTE_C' + - 'ONSEGUIDO) as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO) as IMPOR' + - 'TE_DEVUELTO, sum(IMPORTE_TOTAL_CONSEGUIDO) as IMPORTE_TOTAL_CONS' + - 'EGUIDO,'#10#10' (sum(CANTIDAD_TOTAL_CONSEGUIDA) - sum(CANTIDAD_OBJE' + - 'TIVO)) as CANTIDAD_RESULTADO,'#10' (sum(IMPORTE_TOTAL_CONSEGUIDO)' + - ' - sum(IMPORTE_OBJETIVO)) as IMPORTE_RESULTADO,'#10#10' case when (' + - 'sum(CANTIDAD_TOTAL_CONSEGUIDA) <> 0) then (sum(IMPORTE_TOTAL_CON' + - 'SEGUIDO)/sum(CANTIDAD_TOTAL_CONSEGUIDA))'#10' else 0'#10' end as I' + - 'MPORTE_MEDIO_UNIDAD,'#10#10' case when (sum(CLIENTES_ACTIVOS) <> 0)' + - ' then (sum(IMPORTE_TOTAL_CONSEGUIDO)/sum(CLIENTES_ACTIVOS))'#10' ' + - 'else 0'#10' end as IMPORTE_MEDIO_CLIENTE'#10#10#10'from'#10'('#10'select AO.ID_AG' + - 'ENTE, AO.ANO, AO.MES,'#10'0 as ALTAS_CLIENTE,'#10'0 as CLIENTES_ACTIVOS,' + - #10'sum(AO.CANTIDAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum(AO.IMPORTE_' + - 'OBJETIVO) as IMPORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUIDA, 0 as CA' + - 'NTIDAD_DEVUELTA, 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 as IMPORTE_CO' + - 'NSEGUIDO, 0 as IMPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_CONSEGUIDO'#10'f' + - 'rom V_INF_OBJETIVOS_ALB_AGENTES AO'#10'left join contactos C on (C.I' + - 'D = AO.ID_AGENTE)'#10'where (AO.ANO = :ANO1)'#10'group by 1,2,3'#10#10'UNION A' + - 'LL'#10#10'select ID_AGENTE, ANO, MES,'#10'0 as ALTAS_CLIENTE,'#10'0 as CLIENTE' + - 'S_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORTE_OBJETIVO,'#10'sum(CA' + - 'NTIDAD_CONSEGUIDA) as CANTIDAD_CONSEGUIDA, sum(CANTIDAD_DEVUELTA' + - ') as CANTIDAD_DEVUELTA, (sum(CANTIDAD_CONSEGUIDA) + sum(CANTIDAD' + - '_DEVUELTA)) as CANTIDAD_TOTAL_CONSEGUIDA,'#10'sum(IMPORTE_CONSEGUIDO' + - ') as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO) as IMPORTE_DEVUEL' + - 'TO, (sum(IMPORTE_CONSEGUIDO) + sum(IMPORTE_DEVUELTO)) as IMPORTE' + - '_TOTAL_CONSEGUIDO'#10'from v_inf_objetivos_facturas'#10'where ((v_inf_ob' + - 'jetivos_facturas.id_empresa = :ID_EMPRESA) and (v_inf_objetivos_' + - 'facturas.ANO = :ANO1))'#10'group by 1,2,3'#10#10'UNION ALL'#10#10'select ID_AGEN' + - 'TE, ANO, MES,'#10'count(ID_CLIENTE) as ALTAS_CLIENTE,'#10'0 as CLIENTES_' + - 'ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORTE_OBJETIVO,'#10'0 as CAN' + - 'TIDAD_CONSEGUIDA, 0 as CANTIDAD_DEVUELTA, 0 as CANTIDAD_TOTAL_CO' + - 'NSEGUIDA, 0 as IMPORTE_CONSEGUIDO, 0 as IMPORTE_DEVUELTO, 0 as I' + - 'MPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_obj_clientes_agentes'#10'where (A' + - 'NO = :ANO1)'#10'group by 1,2,3'#10#10'union all'#10#10'select ID_AGENTE, ANO, ME' + - 'S,'#10'0 as ALTAS_CLIENTE,'#10'count(distinct ID_CLIENTE) as CLIENTES_AC' + - 'TIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORTE_OBJETIVO,'#10'0 as CANTI' + - 'DAD_CONSEGUIDA, 0 as CANTIDAD_DEVUELTA, 0 as CANTIDAD_TOTAL_CONS' + - 'EGUIDA, 0 as IMPORTE_CONSEGUIDO, 0 as IMPORTE_DEVUELTO, 0 as IMP' + - 'ORTE_TOTAL_CONSEGUIDO'#10'from v_inf_obj_cli_activos_fac_age'#10'where (' + - 'ANO = :ANO1) and (v_inf_obj_cli_activos_fac_age.ID_EMPRESA = :ID' + - '_EMPRESA)'#10'group by 1,2,3'#10#10') SEN'#10#10'left join periodos_aux P on ((P' + - '.periodo = '#39'MENSUAL'#39') and (P.valor = MES))'#10'left join contactos C' + - ' on (C.ID = SEN.ID_AGENTE)'#10'left join agentes_datos AD on (AD.id_' + - 'agente = SEN.ID_AGENTE)'#10#10'left join'#10'('#10'select coalesce(ID_AGENTE, ' + - '-1) as ID_AGENTE, count(ID_CLIENTE) as NUM_CLIENTES_TOTALES'#10'from' + - ' clientes_datos'#10'group by 1'#10') CLIENTES_TOTALES on (CLIENTES_TOTAL' + - 'ES.ID_AGENTE = SEN.id_Agente)'#10#10'where AD.FECHA_BAJA is null'#10'and {' + - 'where}'#10'group by 1,2,3,4,5'#10'order by 1,2,3,4,5'#10#10#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_AGENTE' - TableField = 'ID_AGENTE' - end - item - DatasetField = 'AGENTE' - TableField = 'AGENTE' - end - item - DatasetField = 'ANO' - TableField = 'ANO' - end - item - DatasetField = 'MES' - TableField = 'MES' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'CLIENTES_TOTALES' - TableField = 'CLIENTES_TOTALES' - end - item - DatasetField = 'ALTAS_CLIENTE' - TableField = 'ALTAS_CLIENTE' - end - item - DatasetField = 'CANTIDAD_OBJETIVO' - TableField = 'CANTIDAD_OBJETIVO' - end - item - DatasetField = 'IMPORTE_OBJETIVO' - TableField = 'IMPORTE_OBJETIVO' - end - item - DatasetField = 'CANTIDAD_CONSEGUIDA' - TableField = 'CANTIDAD_CONSEGUIDA' - end - item - DatasetField = 'CANTIDAD_DEVUELTA' - TableField = 'CANTIDAD_DEVUELTA' - end - item - DatasetField = 'CANTIDAD_TOTAL_CONSEGUIDA' - TableField = 'CANTIDAD_TOTAL_CONSEGUIDA' - end - item - DatasetField = 'IMPORTE_CONSEGUIDO' - TableField = 'IMPORTE_CONSEGUIDO' - end - item - DatasetField = 'IMPORTE_DEVUELTO' - TableField = 'IMPORTE_DEVUELTO' - end - item - DatasetField = 'IMPORTE_TOTAL_CONSEGUIDO' - TableField = 'IMPORTE_TOTAL_CONSEGUIDO' - end - item - DatasetField = 'CANTIDAD_RESULTADO' - TableField = 'CANTIDAD_RESULTADO' - end - item - DatasetField = 'IMPORTE_RESULTADO' - TableField = 'IMPORTE_RESULTADO' - end - item - DatasetField = 'IMPORTE_MEDIO_UNIDAD' - TableField = 'IMPORTE_MEDIO_UNIDAD' - end - item - DatasetField = 'IMPORTE_MEDIO_CLIENTE' - TableField = 'IMPORTE_MEDIO_CLIENTE' - end> - end> - Name = 'InformeListadoObjetivosMensual' - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 269 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'MES' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CLIENTES_TOTALES' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select SEN.ID_AGENTE, COALESCE(C.NOMBRE, '#39'SIN ASIGNAR'#39') || '#39' ('#39' ' + - '|| CLIENTES_TOTALES.NUM_CLIENTES_TOTALES || '#39')'#39' as AGENTE, ANO, ' + - 'SEMESTRE,'#10' P.descripcion,'#10#10' sum(ALTAS_CLIENTE) as ALTAS_CL' + - 'IENTE,'#10#10' sum(CLIENTES_ACTIVOS) as CLIENTES_TOTALES,'#10#10' sum(' + - 'CANTIDAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum(IMPORTE_OBJETIVO) a' + - 's IMPORTE_OBJETIVO,'#10#10' sum(CANTIDAD_CONSEGUIDA) as CANTIDAD_CO' + - 'NSEGUIDA, sum(CANTIDAD_DEVUELTA) as CANTIDAD_DEVUELTA, sum(CANTI' + - 'DAD_TOTAL_CONSEGUIDA) as CANTIDAD_TOTAL_CONSEGUIDA,'#10' sum(IMPO' + - 'RTE_CONSEGUIDO) as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO) as ' + - 'IMPORTE_DEVUELTO, sum(IMPORTE_TOTAL_CONSEGUIDO) as IMPORTE_TOTAL' + - '_CONSEGUIDO,'#10#10' (sum(CANTIDAD_TOTAL_CONSEGUIDA) - sum(CANTIDAD' + - '_OBJETIVO)) as CANTIDAD_RESULTADO,'#10' (sum(IMPORTE_TOTAL_CONSEG' + - 'UIDO) - sum(IMPORTE_OBJETIVO)) as IMPORTE_RESULTADO,'#10#10' case w' + - 'hen (sum(CANTIDAD_TOTAL_CONSEGUIDA) <> 0) then (sum(IMPORTE_TOTA' + - 'L_CONSEGUIDO)/sum(CANTIDAD_TOTAL_CONSEGUIDA))'#10' else 0'#10' end' + - ' as IMPORTE_MEDIO_UNIDAD,'#10#10' case when (sum(CLIENTES_ACTIVOS) ' + - '<> 0) then (sum(IMPORTE_TOTAL_CONSEGUIDO)/sum(CLIENTES_ACTIVOS))' + - #10' else 0'#10' end as IMPORTE_MEDIO_CLIENTE'#10#10#10'from'#10'('#10'select AO.' + - 'ID_AGENTE, AO.ANO, AO.SEMESTRE,'#10'0 as ALTAS_CLIENTE,'#10'0 as CLIENTE' + - 'S_ACTIVOS,'#10'sum(AO.CANTIDAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum(A' + - 'O.IMPORTE_OBJETIVO) as IMPORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUID' + - 'A, 0 as CANTIDAD_DEVUELTA, 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 as ' + - 'IMPORTE_CONSEGUIDO, 0 as IMPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_CO' + - 'NSEGUIDO'#10'from V_INF_OBJETIVOS_ALB_AGENTES AO'#10'left join contactos' + - ' C on (C.ID = AO.ID_AGENTE)'#10'where (AO.ANO = :ANO1)'#10'group by 1,2,' + - '3'#10#10'UNION ALL'#10#10'select ID_AGENTE, ANO, SEMESTRE,'#10'0 as ALTAS_CLIENT' + - 'E,'#10'0 as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORTE_O' + - 'BJETIVO,'#10'sum(CANTIDAD_CONSEGUIDA) as CANTIDAD_CONSEGUIDA, sum(CA' + - 'NTIDAD_DEVUELTA) as CANTIDAD_DEVUELTA, (sum(CANTIDAD_CONSEGUIDA)' + - ' + sum(CANTIDAD_DEVUELTA)) as CANTIDAD_TOTAL_CONSEGUIDA,'#10'sum(IMP' + - 'ORTE_CONSEGUIDO) as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO) as' + - ' IMPORTE_DEVUELTO, (sum(IMPORTE_CONSEGUIDO) + sum(IMPORTE_DEVUEL' + - 'TO)) as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_objetivos_facturas'#10'w' + - 'here ((v_inf_objetivos_facturas.id_empresa = :ID_EMPRESA) and (v' + - '_inf_objetivos_facturas.ANO = :ANO1))'#10'group by 1,2,3'#10#10'UNION ALL'#10 + - #10'select ID_AGENTE, ANO, SEMESTRE,'#10'count(ID_CLIENTE) as ALTAS_CLI' + - 'ENTE,'#10'0 as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORT' + - 'E_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUIDA, 0 as CANTIDAD_DEVUELTA, 0 ' + - 'as CANTIDAD_TOTAL_CONSEGUIDA, 0 as IMPORTE_CONSEGUIDO, 0 as IMPO' + - 'RTE_DEVUELTO, 0 as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_obj_clien' + - 'tes_agentes'#10'where (ANO = :ANO1)'#10'group by 1,2,3'#10#10'UNION ALL'#10#10'selec' + - 't ID_AGENTE, ANO, SEMESTRE,'#10'0 as ALTAS_CLIENTE,'#10'count(distinct I' + - 'D_CLIENTE) as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMP' + - 'ORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUIDA, 0 as CANTIDAD_DEVUELTA,' + - ' 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 as IMPORTE_CONSEGUIDO, 0 as I' + - 'MPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_obj_cl' + - 'i_activos_fac_age'#10'where (ANO = :ANO1) and (v_inf_obj_cli_activos' + - '_fac_age.ID_EMPRESA = :ID_EMPRESA)'#10'group by 1,2,3'#10#10') SEN'#10#10'left j' + - 'oin periodos_aux P on ((P.periodo = '#39'SEMESTRAL'#39') and (P.valor = ' + - 'SEMESTRE))'#10'left join contactos C on (C.ID = SEN.ID_AGENTE)'#10'left ' + - 'join agentes_datos AD on (AD.id_agente = SEN.ID_AGENTE)'#10#10'left jo' + - 'in'#10'('#10'select coalesce(ID_AGENTE, -1) as ID_AGENTE, count(ID_CLIEN' + - 'TE) as NUM_CLIENTES_TOTALES'#10'from clientes_datos'#10'group by 1'#10') CLI' + - 'ENTES_TOTALES on (CLIENTES_TOTALES.ID_AGENTE = SEN.id_Agente)'#10#10'w' + - 'here AD.FECHA_BAJA is null'#10'and {where}'#10'group by 1,2,3,4,5'#10'order ' + - 'by 1,2,3,4,5'#10#10#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_AGENTE' - TableField = 'ID_AGENTE' - end - item - DatasetField = 'AGENTE' - TableField = 'AGENTE' - end - item - DatasetField = 'ANO' - TableField = 'ANO' - end - item - DatasetField = 'SEMESTRE' - TableField = 'SEMESTRE' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'CLIENTES_TOTALES' - TableField = 'CLIENTES_TOTALES' - end - item - DatasetField = 'ALTAS_CLIENTE' - TableField = 'ALTAS_CLIENTE' - end - item - DatasetField = 'CANTIDAD_OBJETIVO' - TableField = 'CANTIDAD_OBJETIVO' - end - item - DatasetField = 'IMPORTE_OBJETIVO' - TableField = 'IMPORTE_OBJETIVO' - end - item - DatasetField = 'CANTIDAD_CONSEGUIDA' - TableField = 'CANTIDAD_CONSEGUIDA' - end - item - DatasetField = 'CANTIDAD_DEVUELTA' - TableField = 'CANTIDAD_DEVUELTA' - end - item - DatasetField = 'CANTIDAD_TOTAL_CONSEGUIDA' - TableField = 'CANTIDAD_TOTAL_CONSEGUIDA' - end - item - DatasetField = 'IMPORTE_CONSEGUIDO' - TableField = 'IMPORTE_CONSEGUIDO' - end - item - DatasetField = 'IMPORTE_DEVUELTO' - TableField = 'IMPORTE_DEVUELTO' - end - item - DatasetField = 'IMPORTE_TOTAL_CONSEGUIDO' - TableField = 'IMPORTE_TOTAL_CONSEGUIDO' - end - item - DatasetField = 'CANTIDAD_RESULTADO' - TableField = 'CANTIDAD_RESULTADO' - end - item - DatasetField = 'IMPORTE_RESULTADO' - TableField = 'IMPORTE_RESULTADO' - end - item - DatasetField = 'IMPORTE_MEDIO_UNIDAD' - TableField = 'IMPORTE_MEDIO_UNIDAD' - end - item - DatasetField = 'IMPORTE_MEDIO_CLIENTE' - TableField = 'IMPORTE_MEDIO_CLIENTE' - end> - end> - Name = 'InformeListadoObjetivosSemestral' - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 255 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'SEMESTRE' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'CLIENTES_TOTALES' - DataType = datInteger - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> - end - item - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - Statements = < - item - Connection = 'IBX' - ConnectionType = 'Interbase' - Default = True - Name = 'IBX' - SQL = - 'select SEN.ID_AGENTE, COALESCE(C.NOMBRE, '#39'SIN ASIGNAR'#39') || '#39' ('#39' ' + - '|| CLIENTES_TOTALES.NUM_CLIENTES_TOTALES || '#39')'#39' as AGENTE, ANO, ' + - 'TRIMESTRE,'#10' P.descripcion,'#10#10' sum(ALTAS_CLIENTE) as ALTAS_C' + - 'LIENTE,'#10#10' sum(CLIENTES_ACTIVOS) as CLIENTES_TOTALES,'#10#10' sum' + - '(CANTIDAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum(IMPORTE_OBJETIVO) ' + - 'as IMPORTE_OBJETIVO,'#10#10' sum(CANTIDAD_CONSEGUIDA) as CANTIDAD_C' + - 'ONSEGUIDA, sum(CANTIDAD_DEVUELTA) as CANTIDAD_DEVUELTA, sum(CANT' + - 'IDAD_TOTAL_CONSEGUIDA) as CANTIDAD_TOTAL_CONSEGUIDA,'#10' sum(IMP' + - 'ORTE_CONSEGUIDO) as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO) as' + - ' IMPORTE_DEVUELTO, sum(IMPORTE_TOTAL_CONSEGUIDO) as IMPORTE_TOTA' + - 'L_CONSEGUIDO,'#10#10' (sum(CANTIDAD_TOTAL_CONSEGUIDA) - sum(CANTIDA' + - 'D_OBJETIVO)) as CANTIDAD_RESULTADO,'#10' (sum(IMPORTE_TOTAL_CONSE' + - 'GUIDO) - sum(IMPORTE_OBJETIVO)) as IMPORTE_RESULTADO,'#10#10' case ' + - 'when (sum(CANTIDAD_TOTAL_CONSEGUIDA) <> 0) then (sum(IMPORTE_TOT' + - 'AL_CONSEGUIDO)/sum(CANTIDAD_TOTAL_CONSEGUIDA))'#10' else 0'#10' en' + - 'd as IMPORTE_MEDIO_UNIDAD,'#10#10' case when (sum(CLIENTES_ACTIVOS)' + - ' <> 0) then (sum(IMPORTE_TOTAL_CONSEGUIDO)/sum(CLIENTES_ACTIVOS)' + - ')'#10' else 0'#10' end as IMPORTE_MEDIO_CLIENTE'#10#10#10'from'#10'('#10'select AO' + - '.ID_AGENTE, AO.ANO, AO.TRIMESTRE,'#10'0 as ALTAS_CLIENTE,'#10'0 as CLIEN' + - 'TES_ACTIVOS,'#10'sum(AO.CANTIDAD_OBJETIVO) as CANTIDAD_OBJETIVO, sum' + - '(AO.IMPORTE_OBJETIVO) as IMPORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGU' + - 'IDA, 0 as CANTIDAD_DEVUELTA, 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 a' + - 's IMPORTE_CONSEGUIDO, 0 as IMPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_' + - 'CONSEGUIDO'#10'from V_INF_OBJETIVOS_ALB_AGENTES AO'#10'left join contact' + - 'os C on (C.ID = AO.ID_AGENTE)'#10'where (AO.ANO = :ANO1)'#10'group by 1,' + - '2,3'#10#10'UNION ALL'#10#10'select ID_AGENTE, ANO, TRIMESTRE,'#10'0 as ALTAS_CLI' + - 'ENTE,'#10'0 as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IMPORT' + - 'E_OBJETIVO,'#10'sum(CANTIDAD_CONSEGUIDA) as CANTIDAD_CONSEGUIDA, sum' + - '(CANTIDAD_DEVUELTA) as CANTIDAD_DEVUELTA, (sum(CANTIDAD_CONSEGUI' + - 'DA) + sum(CANTIDAD_DEVUELTA)) as CANTIDAD_TOTAL_CONSEGUIDA,'#10'sum(' + - 'IMPORTE_CONSEGUIDO) as IMPORTE_CONSEGUIDO, sum(IMPORTE_DEVUELTO)' + - ' as IMPORTE_DEVUELTO, (sum(IMPORTE_CONSEGUIDO) + sum(IMPORTE_DEV' + - 'UELTO)) as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_objetivos_factura' + - 's'#10'where ((v_inf_objetivos_facturas.id_empresa = :ID_EMPRESA) and' + - ' (v_inf_objetivos_facturas.ANO = :ANO1))'#10'group by 1,2,3'#10#10'UNION A' + - 'LL'#10#10'select ID_AGENTE, ANO, TRIMESTRE,'#10'count(ID_CLIENTE) as ALTAS' + - '_CLIENTE,'#10'0 as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 as IM' + - 'PORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUIDA, 0 as CANTIDAD_DEVUELTA' + - ', 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 as IMPORTE_CONSEGUIDO, 0 as ' + - 'IMPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_obj_c' + - 'lientes_agentes'#10'where (ANO = :ANO1)'#10'group by 1,2,3'#10#10'UNION ALL'#10#10's' + - 'elect ID_AGENTE, ANO, TRIMESTRE,'#10'0 as ALTAS_CLIENTE,'#10'count(disti' + - 'nct ID_CLIENTE) as CLIENTES_ACTIVOS,'#10'0 as CANTIDAD_OBJETIVO, 0 a' + - 's IMPORTE_OBJETIVO,'#10'0 as CANTIDAD_CONSEGUIDA, 0 as CANTIDAD_DEVU' + - 'ELTA, 0 as CANTIDAD_TOTAL_CONSEGUIDA, 0 as IMPORTE_CONSEGUIDO, 0' + - ' as IMPORTE_DEVUELTO, 0 as IMPORTE_TOTAL_CONSEGUIDO'#10'from v_inf_o' + - 'bj_cli_activos_fac_age'#10'where (ANO = :ANO1) and (v_inf_obj_cli_ac' + - 'tivos_fac_age.ID_EMPRESA = :ID_EMPRESA)'#10'group by 1,2,3'#10#10') SEN'#10#10'l' + - 'eft join periodos_aux P on ((P.periodo = '#39'TRIMESTRAL'#39') and (P.va' + - 'lor = TRIMESTRE))'#10'left join contactos C on (C.ID = SEN.ID_AGENTE' + - ')'#10'left join agentes_datos AD on (AD.id_agente = SEN.ID_AGENTE)'#10#10 + - 'left join'#10'('#10'select coalesce(ID_AGENTE, -1) as ID_AGENTE, count(I' + - 'D_CLIENTE) as NUM_CLIENTES_TOTALES'#10'from clientes_datos'#10'group by ' + - '1'#10') CLIENTES_TOTALES on (CLIENTES_TOTALES.ID_AGENTE = SEN.id_Age' + - 'nte)'#10#10'where FECHA_BAJA is null'#10'and {where}'#10'group by 1,2,3,4,5'#10'or' + - 'der by 1,2,3,4,5'#10#10#10#10 - StatementType = stSQL - ColumnMappings = < - item - DatasetField = 'ID_AGENTE' - TableField = 'ID_AGENTE' - end - item - DatasetField = 'AGENTE' - TableField = 'AGENTE' - end - item - DatasetField = 'ANO' - TableField = 'ANO' - end - item - DatasetField = 'TRIMESTRE' - TableField = 'TRIMESTRE' - end - item - DatasetField = 'DESCRIPCION' - TableField = 'DESCRIPCION' - end - item - DatasetField = 'CLIENTES_TOTALES' - TableField = 'CLIENTES_TOTALES' - end - item - DatasetField = 'ALTAS_CLIENTE' - TableField = 'ALTAS_CLIENTE' - end - item - DatasetField = 'CANTIDAD_OBJETIVO' - TableField = 'CANTIDAD_OBJETIVO' - end - item - DatasetField = 'IMPORTE_OBJETIVO' - TableField = 'IMPORTE_OBJETIVO' - end - item - DatasetField = 'CANTIDAD_CONSEGUIDA' - TableField = 'CANTIDAD_CONSEGUIDA' - end - item - DatasetField = 'CANTIDAD_DEVUELTA' - TableField = 'CANTIDAD_DEVUELTA' - end - item - DatasetField = 'CANTIDAD_TOTAL_CONSEGUIDA' - TableField = 'CANTIDAD_TOTAL_CONSEGUIDA' - end - item - DatasetField = 'IMPORTE_CONSEGUIDO' - TableField = 'IMPORTE_CONSEGUIDO' - end - item - DatasetField = 'IMPORTE_DEVUELTO' - TableField = 'IMPORTE_DEVUELTO' - end - item - DatasetField = 'IMPORTE_TOTAL_CONSEGUIDO' - TableField = 'IMPORTE_TOTAL_CONSEGUIDO' - end - item - DatasetField = 'CANTIDAD_RESULTADO' - TableField = 'CANTIDAD_RESULTADO' - end - item - DatasetField = 'IMPORTE_RESULTADO' - TableField = 'IMPORTE_RESULTADO' - end - item - DatasetField = 'IMPORTE_MEDIO_UNIDAD' - TableField = 'IMPORTE_MEDIO_UNIDAD' - end - item - DatasetField = 'IMPORTE_MEDIO_CLIENTE' - TableField = 'IMPORTE_MEDIO_CLIENTE' - end> - end> - Name = 'InformeListadoObjetivosTrimestral' - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 255 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'TRIMESTRE' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'CLIENTES_TOTALES' - DataType = datInteger - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> end> JoinDataTables = <> UnionDataTables = <> @@ -3743,8 +1217,7 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'ID_FACTURA' DataType = datInteger - Value = '2' - ParamType = daptInput + Value = '' end> MasterParamsMappings.Strings = ( 'ID_FACTURA=ID') @@ -3753,7 +1226,7 @@ object RptFacturasProforma: TRptFacturasProforma RemoteFetchEnabled = False LocalSchema = schReport LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeFacturasCliente_Detalles' + LogicalName = 'InformeFacturasProforma_Detalles' IndexDefs = <> Left = 344 Top = 128 @@ -3764,49 +1237,53 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'ID' DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID' - InPrimaryKey = True + end + item + Name = 'ID_EMPRESA' + DataType = datInteger end item Name = 'REFERENCIA' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_REFERENCIA' end item Name = 'FECHA_FACTURA' DataType = datDateTime - DictionaryEntry = 'FacturasCliente_FECHA_FACTURA' end item - Name = 'TIPO' + Name = 'FECHA_VENCIMIENTO' + DataType = datDateTime + end + item + Name = 'SITUACION' DataType = datString - Size = 1 + Size = 255 end item Name = 'BASE_IMPONIBLE' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_BASE_IMPONIBLE' end item Name = 'DESCUENTO' DataType = datFloat - DictionaryEntry = 'FacturasCliente_DESCUENTO' end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_DESCUENTO' + end + item + Name = 'DESCRIPCION_DESCUENTO' + DataType = datString + Size = 255 end item Name = 'IVA' DataType = datFloat - DictionaryEntry = 'FacturasCliente_IVA' end item Name = 'IMPORTE_IVA' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_IVA' end item Name = 'RE' @@ -3819,166 +1296,125 @@ object RptFacturasProforma: TRptFacturasProforma item Name = 'IMPORTE_TOTAL' DataType = datCurrency - DictionaryEntry = 'FacturasCliente_IMPORTE_TOTAL' end item Name = 'OBSERVACIONES' DataType = datMemo - DictionaryEntry = 'FacturasCliente_OBSERVACIONES' - end - item - Name = 'FORMA_PAGO' - DataType = datString - Size = 255 end item Name = 'ID_CLIENTE' DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID_CLIENTE' end item Name = 'NIF_CIF' DataType = datString Size = 15 - DictionaryEntry = 'FacturasCliente_NIF_CIF' end item Name = 'NOMBRE' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_NOMBRE' + end + item + Name = 'ID_DIRECCION' + DataType = datInteger end item Name = 'CALLE' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_CALLE' - end - item - Name = 'PROVINCIA' - DataType = datString - Size = 255 - DictionaryEntry = 'FacturasCliente_PROVINCIA' - end - item - Name = 'CODIGO_POSTAL' - DataType = datString - Size = 10 - DictionaryEntry = 'FacturasCliente_CODIGO_POSTAL' end item Name = 'POBLACION' DataType = datString Size = 255 - DictionaryEntry = 'FacturasCliente_POBLACION' end item - Name = 'TITULAR' + Name = 'PROVINCIA' DataType = datString Size = 255 end item - Name = 'ENTIDAD' - DataType = datString - Size = 15 - end - item - Name = 'SUCURSAL' - DataType = datString - Size = 15 - end - item - Name = 'DC' - DataType = datString - Size = 15 - end - item - Name = 'CUENTA' - DataType = datString - Size = 15 - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - DictionaryEntry = 'FacturasCliente_ID_EMPRESA' - end - item - Name = 'NIF_CIF_EMPRESA' - DataType = datString - Size = 15 - end - item - Name = 'RAZON_SOCIAL' - DataType = datString - Size = 255 - end - item - Name = 'CALLE_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'POBLACION_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'PROVINCIA_EMPRESA' - DataType = datString - Size = 255 - end - item - Name = 'CODIGO_POSTAL_EMPRESA' + Name = 'CODIGO_POSTAL' DataType = datString Size = 10 end item - Name = 'TELEFONO_1' - DataType = datString - Size = 25 + Name = 'FECHA_ALTA' + DataType = datDateTime end item - Name = 'FAX' - DataType = datString - Size = 25 + Name = 'FECHA_MODIFICACION' + DataType = datDateTime end item - Name = 'MOVIL_1' + Name = 'USUARIO' DataType = datString - Size = 25 + Size = 30 end item - Name = 'EMAIL_1' + Name = 'ID_FORMA_PAGO' + DataType = datInteger + end + item + Name = 'RECARGO_EQUIVALENCIA' + DataType = datSmallInt + end + item + Name = 'ID_TIPO_IVA' + DataType = datInteger + end + item + Name = 'IMPORTE_NETO' + DataType = datCurrency + end + item + Name = 'IMPORTE_PORTE' + DataType = datCurrency + end + item + Name = 'NUM_COPIAS' + DataType = datSmallInt + end + item + Name = 'NUM_CORREOS' + DataType = datSmallInt + end + item + Name = 'DATOS_BANCARIOS' DataType = datString Size = 255 end item - Name = 'PAGINA_WEB' + Name = 'ID_PEDIDO' + DataType = datInteger + end + item + Name = 'REFERENCIA_DEL_CLIENTE' DataType = datString Size = 255 end item - Name = 'REGISTRO_MERCANTIL' - DataType = datString - Size = 255 + Name = 'ID_FACTURA_FINAL' + DataType = datInteger end item - Name = 'LOGOTIPO' - DataType = datBlob + Name = 'FORMA_PAGO' + DataType = datString + Size = 255 end> Params = < item Name = 'ID' DataType = datInteger - Value = '1' - ParamType = daptInput + Value = '' end> LogChanges = False StreamingOptions = [soDisableEventsWhileStreaming] RemoteFetchEnabled = False LocalSchema = schReport LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeFacturasCliente' + LogicalName = 'InformeFacturasProforma' IndexDefs = <> Left = 264 Top = 128 @@ -4022,7 +1458,7 @@ object RptFacturasProforma: TRptFacturasProforma PrintOptions.Printer = 'Default' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 37871.995398692100000000 - ReportOptions.LastChange = 41474.500467106500000000 + ReportOptions.LastChange = 41619.661813958330000000 ReportOptions.VersionBuild = '1' ReportOptions.VersionMajor = '12' ReportOptions.VersionMinor = '13' @@ -4094,46 +1530,6 @@ object RptFacturasProforma: TRptFacturasProforma '.Height - 1;' 'end;' '' - 'procedure DatosEmpresaOnBeforePrint(Sender: TfrxComponent);' - 'var' - ' Cadena: String;' - 'begin' - ' { ' - ' DatosEmpresa.Lines.Clear;' - ' DatosEmpresa.Lines.Add();' - ' DatosEmpresa.Lines.Add();' - '' - ' Cadena := '#39#39';' - ' if ( <> '#39#39') then' - ' Cadena := '#39'TLF: '#39' + ;' - ' if ( <> '#39#39') then' - ' Cadena := Cadena + '#39' FAX: '#39' + ;' - ' DatosEmpresa.Lines.Add(Cadena);' - '' - ' Cadena := '#39#39';' - ' if ( <> '#39#39') then' - ' Cadena := ;' - ' if ( <> '#39#39') then' - - ' Cadena := Cadena + '#39' '#39' + ;' - ' if ( <> '#39#39') then' - - ' Cadena := Cadena + '#39' - '#39' + ;' - ' DatosEmpresa.Lines.Add(Cadena);' - ' } ' - 'end;' - '' - 'procedure Memo15OnBeforePrint(Sender: TfrxComponent);' - 'begin' - ' Memo15.Lines.Clear;' - ' if (StrToFloat() < 0) then' - ' Memo15.Lines.Add('#39'ABONO'#39')' - ' else' - ' Memo15.Lines.Add('#39'FACTURA'#39')' - 'end;' - '' 'procedure Memo20OnBeforePrint(Sender: TfrxComponent);' 'begin' ' if (StrToFloat() = 0) then' @@ -4148,6 +1544,7 @@ object RptFacturasProforma: TRptFacturasProforma 'var' ' Cadena : String;' 'begin' + '{ ' ' if ( <> '#39#39') then' ' begin' ' Cadena := Memo11.Lines.Text;' @@ -4155,6 +1552,7 @@ object RptFacturasProforma: TRptFacturasProforma ' Memo11.Lines.Add();' ' Memo11.Lines.Add(Cadena);' ' end' + ' } ' 'end;' '' 'procedure Band2OnBeforePrint(Sender: TfrxComponent);' @@ -4214,53 +1612,6 @@ object RptFacturasProforma: TRptFacturasProforma Left = 145 Top = 16 end - object frxDBVencimientos: TfrxDBDataset - UserName = 'frxDBVencimientos' - CloseDataSource = False - DataSource = DADSVencimientos - BCDToCurrency = False - Left = 440 - Top = 16 - end - object DADSVencimientos: TDADataSource - DataSet = tbl_Vencimientos.Dataset - DataTable = tbl_Vencimientos - Left = 440 - Top = 72 - end - object tbl_Vencimientos: TDAMemDataTable - RemoteUpdatesOptions = [] - Fields = < - item - Name = 'ID_FACTURA' - DataType = datInteger - end - item - Name = 'FECHA_VENCIMIENTO' - DataType = datDateTime - end - item - Name = 'IMPORTE_TOTAL' - DataType = datCurrency - end> - Params = < - item - Name = 'ID_FACTURA' - Value = '' - ParamType = daptInput - end> - MasterParamsMappings.Strings = ( - 'ID_FACTURA=ID') - LogChanges = False - StreamingOptions = [soDisableEventsWhileStreaming] - RemoteFetchEnabled = False - LocalSchema = schReport - LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeFacturasCliente_Vencimientos' - IndexDefs = <> - Left = 440 - Top = 128 - end object vencimientos: TIBQuery Database = IBDatabase1 Transaction = IBTransaction1 @@ -4319,321 +1670,4 @@ object RptFacturasProforma: TRptFacturasProforma Left = 48 Top = 88 end - object DADSInformeObjetivos: TDADataSource - DataSet = tbl_InformeObjetivosMensual.Dataset - DataTable = tbl_InformeObjetivosMensual - Left = 152 - Top = 152 - end - object frxDBInformeObjetivos: TfrxDBDataset - UserName = 'frxDBInformeObjetivos' - CloseDataSource = False - DataSource = DADSInformeObjetivos - BCDToCurrency = False - Left = 152 - Top = 96 - end - object tbl_InformeObjetivosMensual: TDAMemDataTable - RemoteUpdatesOptions = [] - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 255 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'MES' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'CLIENTES_TOTALES' - DataType = datInteger - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - LogChanges = False - StreamingOptions = [soDisableEventsWhileStreaming] - RemoteFetchEnabled = False - LocalSchema = schReport - LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeListadoObjetivosMensual' - IndexDefs = <> - Left = 64 - Top = 216 - end - object tbl_InformeObjetivosTrimestral: TDAMemDataTable - RemoteUpdatesOptions = [] - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 255 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'TRIMESTRE' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'CLIENTES_TOTALES' - DataType = datInteger - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - LogChanges = False - StreamingOptions = [soDisableEventsWhileStreaming] - RemoteFetchEnabled = False - LocalSchema = schReport - LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeListadoObjetivosTrimestral' - IndexDefs = <> - Left = 192 - Top = 216 - end - object tbl_InformeObjetivosSemestral: TDAMemDataTable - RemoteUpdatesOptions = [] - Fields = < - item - Name = 'ID_AGENTE' - DataType = datInteger - end - item - Name = 'AGENTE' - DataType = datString - Size = 255 - end - item - Name = 'ANO' - DataType = datSmallInt - end - item - Name = 'SEMESTRE' - DataType = datSmallInt - end - item - Name = 'DESCRIPCION' - DataType = datString - Size = 20 - end - item - Name = 'CLIENTES_TOTALES' - DataType = datInteger - end - item - Name = 'ALTAS_CLIENTE' - DataType = datLargeInt - end - item - Name = 'CANTIDAD_OBJETIVO' - DataType = datLargeInt - end - item - Name = 'IMPORTE_OBJETIVO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_DEVUELTA' - DataType = datCurrency - end - item - Name = 'CANTIDAD_TOTAL_CONSEGUIDA' - DataType = datCurrency - end - item - Name = 'IMPORTE_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'IMPORTE_DEVUELTO' - DataType = datCurrency - end - item - Name = 'IMPORTE_TOTAL_CONSEGUIDO' - DataType = datCurrency - end - item - Name = 'CANTIDAD_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_RESULTADO' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_UNIDAD' - DataType = datCurrency - end - item - Name = 'IMPORTE_MEDIO_CLIENTE' - DataType = datCurrency - end> - Params = < - item - Name = 'ANO1' - Value = '2012' - end - item - Name = 'ID_EMPRESA' - DataType = datInteger - Value = '1' - end> - LogChanges = False - StreamingOptions = [soDisableEventsWhileStreaming] - RemoteFetchEnabled = False - LocalSchema = schReport - LocalDataStreamer = Bin2DataStreamer - LogicalName = 'InformeListadoObjetivosSemestral' - IndexDefs = <> - Left = 312 - Top = 216 - end end diff --git a/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.pas b/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.pas index a67e89a..5c26709 100644 --- a/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.pas +++ b/Source/Modulos/Facturas proforma/Reports/uRptFacturasProforma_Server.pas @@ -70,9 +70,6 @@ type detallesIMPORTE_TOTAL: TIBBCDField; detallesVISIBLE: TSmallintField; detallesREFERENCIA: TIBStringField; - frxDBVencimientos: TfrxDBDataset; - DADSVencimientos: TDADataSource; - tbl_Vencimientos: TDAMemDataTable; vencimientos: TIBQuery; DataSource3: TDataSource; cabeceraDATOS_BANCARIOS: TIBStringField; @@ -80,11 +77,6 @@ type vencimientosIMPORTE_TOTAL: TIBBCDField; frxPDFExport1: TfrxPDFExport; Bin2DataStreamer: TDABin2DataStreamer; - DADSInformeObjetivos: TDADataSource; - frxDBInformeObjetivos: TfrxDBDataset; - tbl_InformeObjetivosMensual: TDAMemDataTable; - tbl_InformeObjetivosTrimestral: TDAMemDataTable; - tbl_InformeObjetivosSemestral: TDAMemDataTable; schReport: TDASchema; procedure DataModuleCreate(Sender: TObject); procedure DataModuleDestroy(Sender: TObject); @@ -107,29 +99,14 @@ type FImporteMinimo: Currency; FDesglosado : Boolean; FShowLogotipo: Boolean; - FTopN: Integer; + FTopN: Integer; //Genera cada una de las facturas a imprimir procedure _GenerarFactura(const ID: Integer; const VerSello: Boolean = True; const VerCopia: Boolean = True); - procedure PrepararTablaInforme(ATabla: TDAMemDataTable); - procedure PrepararTablaResumenInforme(ATabla: IDADataset); - procedure PrepararTablaInformeGrafComp(ATabla: TDAMemDataTable); - procedure PrepararTablaResumenInformeGrafComp(ATabla: TDAMemDataTable); - procedure PrepararTablaInformeObjetivos(ATabla: TDAMemDataTable); - function _GenerarInforme(const TipoInforme: String): Binary; - procedure IniciarParametrosInforme; - procedure RecuperarNombresClientes; - procedure RecuperarNombresAgentes; public function GenerarFactura(const ListaID : TIntegerArray; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary; function GenerarFacturaEnPDF(const ListaID : TIntegerArray; const VerSello: Boolean = True): Binary; - function GenerarInformeIVA(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary; - function GenerarInformeListadoFacturas(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const FechaVenInicio: Variant; const FechaVenFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary; - function GenerarInformeListadoFacturasPendientes(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const FechaVenInicio: Variant; const FechaVenFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary; - function GenerarInformeFacturasGrafComp(const IdEmpresa: Integer; const Intervalo: Variant; const Ano1: Variant; const Ano2: Variant; const ListaIDClientes: TIntegerArray; const TopN: Integer): Binary; - function GenerarInformeBeneficiosGrafComp(const IdEmpresa: Integer; const Intervalo: Variant; const Ano1: Variant; const Ano2: Variant; const Serie: Variant): Binary; - function GenerarInformeObjetivosAgentesFacturas(const IdEmpresa: Integer; const Intervalo: Variant; const Ano1: Variant; const Ano2: Variant; const AgentesActivos: Boolean; const ListaIDAgentes: TIntegerArray; const TopN: Integer): Binary; end; implementation @@ -141,19 +118,7 @@ uses uROServer, DataAbstract4_Intf, srvGestorInformes_Impl; const - rptFacturaCliente = 'InfFacturaCliente.fr3'; - rptInformeIVA = 'InformeIVAClientes.fr3'; - rptInformeIVADesglosado = 'InformeIVAClientesDesglosado.fr3'; - rptInformeListadoFacturasCliente = 'InformeListadoFacturasCliente.fr3'; - rptInformeListadoFacturasClienteDesglosado = 'InformeListadoFacturasClienteDesglosado.fr3'; - rptInformeListadoFactuasClientePendiente = 'InformeListadoFacturasClientePendientes.fr3'; - rptInformeListadoFactuasClientePendienteDesglosado = 'InformeListadoFacturasClientePendientesDesglosado.fr3'; - rptInformeListadoFacturasClienteGrafComp = 'InformeListadoFacturasClienteGrafComp.fr3'; - rptInformeListadoBeneficiosGrafComp = 'InformeListadoBeneficiosGrafComp.fr3'; - rptInformeObjetivosAgentesFacturas = 'InformeObjetivosAgentesFacturas.fr3'; - - { Dataset names for schReport } - ds_InformeListadoFacturasResumen = 'InformeListadoFacturasResumen'; + rptFacturaProforma = 'InfFacturaProforma.fr3'; { TRptFacturasCliente } @@ -168,23 +133,19 @@ begin frxReport.EngineOptions.NewSilentMode := simReThrow; FListaNombresClientes := TStringList.Create; - FListaNombresAgentes := TStringList.Create; + FListaNombresAgentes := TStringList.Create; frxDBCabecera.DataSource := DADSCabecera; frxDBCabecera.CloseDataSource := False; frxDBDetalles.DataSource := DADSDetalles; frxDBDetalles.CloseDataSource := False; - - frxDBVencimientos.DataSource := DADSVencimientos; - frxDBVencimientos.CloseDataSource := False; end; procedure TRptFacturasProforma.DataModuleDestroy(Sender: TObject); begin tbl_Cabecera.Active := False; tbl_Detalles.Active := False; - tbl_Vencimientos.Active := False; FreeANDNIL(FListaNombresClientes); FreeANDNIL(FListaNombresAgentes); @@ -230,796 +191,6 @@ begin end; end; -function TRptFacturasProforma.GenerarInformeBeneficiosGrafComp( - const IdEmpresa: Integer; const Intervalo, Ano1, Ano2, - Serie: Variant): Binary; -var - AStream: TMemoryStream; - AInforme: Variant; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FAno1 := Ano1; - FAno2 := Ano2; - FIntervalo := Intervalo; - - //Preparamos la tabla correspondiente y la abrimos para el informe - if (FIntervalo = CTE_MENSUAL) then - PrepararTablaInformeGrafComp(tbl_InformeListadoBeneficiosGrafCompMensual) - else if (FIntervalo = CTE_TRIMESTRAL) then - PrepararTablaInformeGrafComp(tbl_InformeListadoBeneficiosGrafCompTrimestral) - else - PrepararTablaInformeGrafComp(tbl_InformeListadoBeneficiosGrafCompSemestral); - - Result := Binary.Create; - - AInforme := DarRutaFichero(DarRutaInformes, rptInformeListadoBeneficiosGrafComp, IntTostr(FIdEmpresa)); - if VarIsNull(AInforme) then - raise Exception.Create (('Error Servidor: GenerarInformeBeneficiosGrafComp, no encuentra informe ' + rptInformeListadoBeneficiosGrafComp)); - - frxReport.LoadFromFile(AInforme, True); -// IniciarParametrosInforme; - - frxReport.Variables.Variables['Ano1']:= Ano1; - frxReport.Variables.Variables['Ano2']:= Ano2; - frxReport.Variables.Variables['Serie']:= Serie; - frxReport.PrepareReport(False); - frxReport.PreviewPages.SaveToStream(Result); - - finally - AStream.Free; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -function TRptFacturasProforma.GenerarInformeFacturasGrafComp( - const IdEmpresa: Integer; const Intervalo, Ano1, Ano2: Variant; - const ListaIDClientes: TIntegerArray; const TopN: Integer): Binary; -var - AStream: TMemoryStream; - AInforme: Variant; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FAno1 := Ano1; - FAno2 := Ano2; - FIntervalo := Intervalo; - FTopN := TopN; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; - FListaIDClientes := ListaIDClientes; - - //Preparamos la tabla correspondiente y la abrimos para el informe - if (FIntervalo = CTE_MENSUAL) then - PrepararTablaInformeGrafComp(tbl_InformeListadoFacturasGrafCompMensual) - else if (FIntervalo = CTE_TRIMESTRAL) then - PrepararTablaInformeGrafComp(tbl_InformeListadoFacturasGrafCompTrimestral) - else - PrepararTablaInformeGrafComp(tbl_InformeListadoFacturasGrafCompSemestral); - - //Se preparan las tablas del listado resumen del informe - PrepararTablaResumenInformeGrafComp(tbl_InformeListadoClientesMayorFacturacionResumen); - PrepararTablaResumenInformeGrafComp(tbl_InformeListadoClientesMayorDescuentoResumen); - PrepararTablaResumenInformeGrafComp(tbl_InformeListadoAgentesMayorFacturacionResumen); - - Result := Binary.Create; - - AInforme := DarRutaFichero(DarRutaInformes, rptInformeListadoFacturasClienteGrafComp, IntTostr(FIdEmpresa)); - if VarIsNull(AInforme) then - raise Exception.Create (('Error Servidor: GenerarInformeFacturasGrafComp, no encuentra informe ' + rptInformeListadoFacturasClienteGrafComp)); - - frxReport.LoadFromFile(AInforme, True); -// IniciarParametrosInforme; - - frxReport.Variables.Variables['Ano1']:= Ano1; - frxReport.Variables.Variables['Ano2']:= Ano2; - frxReport.PrepareReport(False); - frxReport.PreviewPages.SaveToStream(Result); - - finally - AStream.Free; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -function TRptFacturasProforma.GenerarInformeIVA(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary; -var - ATipoInforme: String; - AStream: TMemoryStream; - dsMaster: IDADataset; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FFechaInicio := FechaInicio; - FFechaFin := FechaFin; - FFechaVenInicio := Null; - FFechaVenFin := Null; - FImporteMinimo := ImporteMinimo; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; - FListaIDClientes := ListaIDClientes; - - //Se van a prepara las tablas del informe - if tbl_InformeListadoFacturas.Active then - tbl_InformeListadoFacturas.Active := False; - PrepararTablaInforme(tbl_InformeListadoFacturas); - - //Se prepara la tabla del listado resumen del informe - if tbl_InformeListadoFacturasResumen.Active then - tbl_InformeListadoFacturasResumen.Active := False; - dsMaster := schReport.NewDataset(FConnection, ds_InformeListadoFacturasResumen, [], [], False); - PrepararTablaResumenInforme(dsMaster); - //Esto se hace para rellenar la tabla del datamodule que usa el informe. - dsMaster.Open; - AStream.Clear; - Bin2DataStreamer.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1); - Bin2DataStreamer.ReadDataset(AStream, tbl_InformeListadoFacturasResumen, TRUE, '', TRUE, TRUE); - - //DESGLOSADO POR CLIENTE EN ESTE INFORME NO SE DESGLOSARÁ POR CLIENTE - if Desglosado then - ATipoInforme := rptInformeIVADesglosado - else - ATipoInforme := rptInformeIVA; - - //Finalmente se abren las tablas del informe - tbl_InformeListadoFacturas.Active := True; - tbl_InformeListadoFacturasResumen.Active := True; - - Result := _GenerarInforme(ATipoInforme); - finally - AStream.Free; - dsMaster := Nil; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -function TRptFacturasProforma.GenerarInformeListadoFacturas(const IdEmpresa: Integer; - const FechaInicio, FechaFin: Variant; const FechaVenInicio: Variant; const FechaVenFin: Variant; - const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary; -var - ATipoInforme: String; - AStream: TMemoryStream; - dsMaster: IDADataset; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FFechaInicio := FechaInicio; - FFechaFin := FechaFin; - FFechaVenInicio := FechaVenInicio; - FFechaVenFin := FechaVenFin; - FImporteMinimo := ImporteMinimo; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; - FListaIDClientes := ListaIDClientes; - - //Se prepara la tabla del listado general del informe - if tbl_InformeListadoFacturas.Active then - tbl_InformeListadoFacturas.Active := False; - PrepararTablaInforme(tbl_InformeListadoFacturas); - - //Se prepara la tabla del listado resumen del informe - if tbl_InformeListadoFacturasResumen.Active then - tbl_InformeListadoFacturasResumen.Active := False; - dsMaster := schReport.NewDataset(FConnection, ds_InformeListadoFacturasResumen, [], [], False); - PrepararTablaResumenInforme(dsMaster); - //Esto se hace para rellenar la tabla del datamodule que usa el informe. - dsMaster.Open; - AStream.Clear; - Bin2DataStreamer.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1); - Bin2DataStreamer.ReadDataset(AStream, tbl_InformeListadoFacturasResumen, TRUE, '', TRUE, TRUE); - - //DESGLOSADO POR CLIENTE EN ESTE INFORME NO SE DESGLOSARÁ POR CLIENTE - FDesglosado := Desglosado; - if FDesglosado then - ATipoInforme := rptInformeListadoFacturasClienteDesglosado - else - ATipoInforme := rptInformeListadoFacturasCliente; - - //Finalmente se abren las tablas del informe - tbl_InformeListadoFacturas.Active := True; - tbl_InformeListadoFacturasResumen.Active := True; - - Result := _GenerarInforme(ATipoInforme); - - finally - AStream.Free; - dsMaster := Nil; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -function TRptFacturasProforma.GenerarInformeListadoFacturasPendientes( - const IdEmpresa: Integer; const FechaInicio, FechaFin: Variant; - const FechaVenInicio: Variant; const FechaVenFin: Variant; - const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; - const ImporteMinimo: Currency): Binary; -var - Condicion: TDAWhereExpression; - ATipoInforme: String; - AStream: TMemoryStream; - dsMaster: IDADataset; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FFechaInicio := FechaInicio; - FFechaFin := FechaFin; - FFechaVenInicio := FechaVenInicio; - FFechaVenFin := FechaVenFin; - FImporteMinimo := ImporteMinimo; - FListaIDClientes := ListaIDClientes; - - //Se prepara la tabla del listado general del informe - if tbl_InformeListadoFacturasPendientes.Active then - tbl_InformeListadoFacturasPendientes.Active := False; - PrepararTablaInforme(tbl_InformeListadoFacturasPendientes); - - // Filtrar el informe por situacion - with tbl_InformeListadoFacturasPendientes.DynamicWhere do - begin - // (ID_EMPRESA >= ID) - Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteSITUACION), NewConstant('PAGADA', datString), dboNotEqual); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - - //DESGLOSADO POR CLIENTE EN ESTE INFORME NO SE DESGLOSARÁ POR CLIENTE - FDesglosado := Desglosado; - if FDesglosado then - ATipoInforme := rptInformeListadoFactuasClientePendienteDesglosado - else - ATipoInforme := rptInformeListadoFactuasClientePendiente; - - //Finalmente se abren las tablas del informe - tbl_InformeListadoFacturasPendientes.Active := True; - - Result := _GenerarInforme(ATipoInforme); - - finally - AStream.Free; - dsMaster := Nil; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -function TRptFacturasProforma.GenerarInformeObjetivosAgentesFacturas( - const IdEmpresa: Integer; const Intervalo, Ano1, Ano2: Variant; - const AgentesActivos: Boolean; const ListaIDAgentes: TIntegerArray; const TopN: Integer): Binary; -var - AStream: TMemoryStream; - AInforme: Variant; - -begin - FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - - AStream := TMemoryStream.Create; - try - //Inicializamos parametros - FIdEmpresa := IdEmpresa; - FAno1 := Ano1; - FIntervalo := Intervalo; - FAgentesActivos := AgentesActivos; - FFechaVenInicio := Null; - FFechaVenFin := Null; - - if Assigned(FListaIDAgentes) then - FListaIDClientes.Free; - FListaIDAgentes := ListaIDAgentes; - - //Preparamos la tabla correspondiente y la abrimos para el informe - if (FIntervalo = CTE_MENSUAL) then - PrepararTablaInformeObjetivos(tbl_InformeObjetivosMensual) - else if (FIntervalo = CTE_TRIMESTRAL) then - PrepararTablaInformeObjetivos(tbl_InformeObjetivosTrimestral) - else - PrepararTablaInformeObjetivos(tbl_InformeObjetivosSemestral); - - Result := Binary.Create; - - AInforme := DarRutaFichero(DarRutaInformes, rptInformeObjetivosAgentesFacturas, IntTostr(FIdEmpresa)); - if VarIsNull(AInforme) then - raise Exception.Create (('Error Servidor: GenerarInformeObjetivosAgentesFacturas, no encuentra informe ' + rptInformeObjetivosAgentesFacturas)); - - frxReport.LoadFromFile(AInforme, True); - IniciarParametrosInforme; - - frxReport.PrepareReport(False); - frxReport.PreviewPages.SaveToStream(Result); - - finally - AStream.Free; - FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" - end; -end; - -procedure TRptFacturasProforma.IniciarParametrosInforme; -var - ATextos : TStringList; - ACadena : String; -begin - ATextos := TStringList.Create; - - try - if (not VarIsNull(FFechaInicio)) and (not VarIsNull(FFechaFin)) then - ACadena := Format('Fechas de factura desde el %s hasta el %s', [VarToStr(FFechaInicio), VarToStr(FFechaFin)]) - else - ACadena := 'Sin rango de fechas'; - ATextos.Add(ACadena); - ACadena := ''; - - // Filtrar el informe por fechas de vencimiento - if (not VarIsNull(FFechaVenInicio)) and (not VarIsNull(FFechaVenFin)) then - begin - ACadena := Format('Vencimientos desde el %s hasta el %s', [VarToStr(FFechaVenInicio), VarToStr(FFechaVenFin)]); - ATextos.Add(ACadena); - ACadena := ''; - end; - - if (FImporteMinimo > 0) then - begin - ACadena := Format('Facturas con importe superior a %m', [FImporteMinimo]); - ATextos.Add(ACadena); - ACadena := ''; - end; - - if Assigned(FListaIDClientes) and (FListaIDClientes.Count > 0) then - begin - RecuperarNombresClientes; - ACadena := FListaNombresClientes.Text; - end - else begin - ACadena := 'Todos los clientes'; - if FDesglosado then - ACadena := ACadena + ' (desglosados)' - end; - - if not VarIsNull(FAno1) then - begin - ACadena := 'Año: ' + FAno1; - ATextos.Add(ACadena); - end; - - if Assigned(FListaIDAgentes) and (FListaIDAgentes.Count > 0) then - begin - ACadena := 'Agente: '; - RecuperarNombresAgentes; - ACadena := ACadena + FListaNombresAgentes.Text; - end - else begin - ACadena := 'Todos los agentes'; -// if FDesglosado then - ACadena := ACadena + ' (desglosados)' - end; - - ATextos.Add(ACadena); - ACadena := ''; - - - - ATextos.Add(ACadena); - ACadena := ''; - - frxReport.Variables.Variables['TextoParametros'] := ATextos.Text; - finally - FreeAndNil(ATextos); - end; -end; - -procedure TRptFacturasProforma.PrepararTablaInforme(ATabla: TDAMemDataTable); -var - Condicion: TDAWhereExpression; - i: Integer; - -begin - // Filtrar el informe por empresa - with ATabla.DynamicWhere do - begin - // (ID_EMPRESA >= ID) - Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteID_EMPRESA), NewConstant(FIdEmpresa, datInteger), dboEqual); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - - // Filtrar el informe por fechas - if not VarIsNull(FFechaInicio) - and not VarIsNull(FFechaFin) then - begin - with ATabla.DynamicWhere do - begin - // (FECHA_INICIO between FECHA_FIN) - Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteFECHA_FACTURA), NewConstant(FFechaInicio, datDateTime), dboGreaterOrEqual); - Condicion := NewBinaryExpression(NewBinaryExpression(NewField('', fld_FacturasClienteFECHA_FACTURA), NewConstant(FFechaFin, datDateTime), dboLessOrEqual), Condicion, dboAnd); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; - - // Filtrar el informe por fechas de vencimiento - if not VarIsNull(FFechaVenInicio) - and not VarIsNull(FFechaVenFin) then - begin - with ATabla.DynamicWhere do - begin - // (FECHA_VENCIMIENTO_INICIO between FECHA_VENCIMIENTO_FIN) - Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteFECHA_VENCIMIENTO), NewConstant(FFechaVenInicio, datDateTime), dboGreaterOrEqual); - Condicion := NewBinaryExpression(NewBinaryExpression(NewField('', fld_FacturasClienteFECHA_VENCIMIENTO), NewConstant(FFechaVenFin, datDateTime), dboLessOrEqual), Condicion, dboAnd); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; - - // Filtrar el informe por proveedor - if Assigned(FListaIDClientes) then - begin - with ATabla.DynamicWhere do - begin - for i := 0 to FListaIDClientes.Count - 1 do - begin - - // (ID_CLIENTE = ID) - Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteID_CLIENTE), NewConstant(FListaIDClientes.Items[i], datInteger), dboEqual); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; - end; - - // Filtrar el informe por importe minimo - if (FImporteMinimo > 0) then - begin - with ATabla.DynamicWhere do - begin - // (IMPORTE_TOTAL > ImporteMinimo) - Condicion := NewBinaryExpression(NewField('', fld_FacturasCLienteIMPORTE_TOTAL), NewConstant(FImporteMinimo, datCurrency), dboGreaterOrEqual); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; -end; - -procedure TRptFacturasProforma.PrepararTablaInformeGrafComp( - ATabla: TDAMemDataTable); -begin - if ATabla.Active then - ATabla.Active := False; - - DASInformeListadoFacturasGrafComp.DataTable := ATabla; - ATabla.ParamByName('ID_EMPRESA1').AsInteger := FIdEmpresa; - ATabla.ParamByName('ID_EMPRESA2').AsInteger := FIdEmpresa; - ATabla.ParamByName('ANO1').AsVariant := FAno1; - ATabla.ParamByName('ANO2').AsVariant := FAno2; - ATabla.Active := True; -end; - -procedure TRptFacturasProforma.PrepararTablaInformeObjetivos( - ATabla: TDAMemDataTable); -var - Condicion: TDAWhereExpression; - i: Integer; - -begin - if ATabla.Active then - ATabla.Active := False; -{ - if (FAgentesActivos) then - begin - with ATabla.DynamicWhere do - begin - // (SOLO AGENTES ACTIVOS) - Condicion := NewBinaryExpression(NewField('AD', 'FECHA_BAJA'), NewNull(), dboEqual); - - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; -} - // Filtrar el informe por agente - if Assigned(FListaIDAgentes) then - begin - with ATabla.DynamicWhere do - begin - for i := 0 to FListaIDAgentes.Count - 1 do - begin - - // (ID_AGENTE = ID) - Condicion := NewBinaryExpression(NewField('SEN', 'ID_AGENTE'), NewConstant(FListaIDAgentes.Items[i], datInteger), dboEqual); - if IsEmpty then - Expression := Condicion - else - Expression := NewBinaryExpression(Expression, Condicion, dboAnd); - end; - end; - end; - - DADSInformeObjetivos.DataTable := ATabla; - ATabla.ParamByName('ID_EMPRESA').AsInteger := FIdEmpresa; - ATabla.ParamByName('ANO1').AsVariant := FAno1; - ATabla.Active := True; -end; - -procedure TRptFacturasProforma.PrepararTablaResumenInforme(ATabla: IDADataset); -var - i: Integer; - AWhereStr : String; - -begin - // Filtrar el informe por empresa - AWhereStr := ' (' + fld_FacturasCLienteID_EMPRESA + ' = ' + IntToStr(FIdEmpresa) + ') '; - - // Filtrar el informe por fechas - if not VarIsNull(FFechaInicio) - and not VarIsNull(FFechaFin) then - begin - if Length(AWhereStr) > 0 then - AWhereStr := AWhereStr + 'AND'; - AWhereStr := AWhereStr + ' (' + fld_FacturasCLienteFECHA_FACTURA + ' between ''' + ReplaceStr(VarToStr(FFechaInicio),'/','.') + ''' and ''' + ReplaceStr(VarToStr(FFechaFin),'/','.') + ''') '; - end; - - // Filtrar el informe por fechas de vencimiento - if not VarIsNull(FFechaVenInicio) - and not VarIsNull(FFechaVenFin) then - begin - if Length(AWhereStr) > 0 then - AWhereStr := AWhereStr + 'AND'; - AWhereStr := AWhereStr + ' (' + fld_FacturasCLienteFECHA_VENCIMIENTO + ' between ''' + ReplaceStr(VarToStr(FFechaVenInicio),'/','.') + ''' and ''' + ReplaceStr(VarToStr(FFechaVenFin),'/','.') + ''') '; - end; - - // Filtrar el informe por proveedor - if Assigned(FListaIDClientes) then - begin - for i := 0 to FListaIDClientes.Count - 1 do - begin - if Length(AWhereStr) > 0 then - AWhereStr := AWhereStr + 'AND'; - AWhereStr := AWhereStr + ' (' + fld_FacturasCLienteID_CLIENTE + ' = ' + IntToStr(FListaIDClientes.Items[i]) + ') '; - end; - end; - - // Filtrar el informe por importe minimo - if (FImporteMinimo > 0) then - begin - if Length(AWhereStr) > 0 then - AWhereStr := AWhereStr + 'AND'; - AWhereStr := AWhereStr + ' (' + fld_FacturasCLienteIMPORTE_TOTAL + ' >= ' + CurrToStr(FImporteMinimo) + ') '; - end; - - ATabla.Where.AddText(AWhereStr); -end; - -procedure TRptFacturasProforma.PrepararTablaResumenInformeGrafComp( - ATabla: TDAMemDataTable); -begin - if ATabla.Active then - ATabla.Active := False; - - ATabla.ParamByName('ID_EMPRESA').AsInteger := FIdEmpresa; - ATabla.ParamByName('ANO').AsVariant := FAno1; - ATabla.ParamByName('ANO2').AsVariant := FAno2; - ATabla.ParamByName('NTOP').AsInteger := FTopN; - ATabla.Active := True; -end; - -procedure TRptFacturasProforma.RecuperarNombresAgentes; -var - AContactosService : IsrvContactos; - Intf : IInterface; - AClientID : TGUID; - - ATableNameArray: StringArray; - ATableRequestInfoArray: TableRequestInfoArray; - ATableRequestInfo: TableRequestInfoV5; - AStream: TMemoryStream; - ADataTable: TDAMemDataTable; - i: Integer; - AWhereBuilder : TDAWhereBuilder; - ACondicion : TDAWhereExpression; -begin - CreateGUID(AClientID); - - GetClassFactory('srvContactos').CreateInstance(AClientID, Intf); - - if Assigned(Intf) then - begin - AContactosService := Intf as IsrvContactos; - - ATableNameArray := StringArray.Create; - ATableRequestInfoArray := TableRequestInfoArray.Create; - AWhereBuilder := TDAWhereBuilder.Create; - try - ATableNameArray.Add('Agentes'); - ATableRequestInfo := TableRequestInfoV5.Create; - - with ATableRequestInfo do - begin - IncludeSchema := True; - MaxRecords := -1; - UserFilter := ''; - - AWhereBuilder.Clear; - with AWhereBuilder do - for i := 0 to FListaIDAgentes.Count - 1 do - begin - ACondicion := NewBinaryExpression( - NewBinaryExpression(NewField('', 'ID'), NewConstant(FListaIDAgentes[i], datInteger), dboEqual), - NewBinaryExpression(NewField('', 'ID_EMPRESA'), NewConstant(FIdEmpresa, datInteger), dboEqual), - dboAnd); - - if not AWhereBuilder.IsEmpty then - Expression := NewBinaryExpression(Expression, ACondicion, dboOr) - else - Expression := ACondicion; - end; - - WhereClause := AWhereBuilder.ExpressionToXmlNode(AWhereBuilder.Expression); - end; - - try - ATableRequestInfoArray.Add(ATableRequestInfo); - AStream := AContactosService.GetData(ATableNameArray, ATableRequestInfoArray); - if Assigned(AStream) then - begin - ADataTable := TDAMemDataTable.Create(nil); - try - ADataTable.Name := 'Agentes'; - ADataTable.LocalDataStreamer := Bin2DataStreamer; - ADataTable.RemoteFetchEnabled := False; - Bin2DataStreamer.ReadDataset(AStream, ADataTable, True); - - ADataTable.Open; - FListaNombresAgentes.Clear; - for i := 0 to ADataTable.RecordCount - 1 do - begin - FListaNombresAgentes.Add(ADataTable.FieldByName('NOMBRE').AsString); - ADataTable.Next; - end; - - finally - FreeANDNil(ADataTable); - end; - end; - except - on e: Exception do - dmServer.EscribirLog(e.Message); - end; - finally - FreeANDNIL(ATableRequestInfoArray); - FreeANDNIL(ATableNameArray); - FreeANDNIL(AWhereBuilder); - end; - end; -end; - -procedure TRptFacturasProforma.RecuperarNombresClientes; -var - AContactosService : IsrvContactos; - Intf : IInterface; - AClientID : TGUID; - - ATableNameArray: StringArray; - ATableRequestInfoArray: TableRequestInfoArray; - ATableRequestInfo: TableRequestInfoV5; - AStream: TMemoryStream; - ADataTable: TDAMemDataTable; - i: Integer; - AWhereBuilder : TDAWhereBuilder; - ACondicion : TDAWhereExpression; -begin - CreateGUID(AClientID); - - GetClassFactory('srvContactos').CreateInstance(AClientID, Intf); - - if Assigned(Intf) then - begin - AContactosService := Intf as IsrvContactos; - - ATableNameArray := StringArray.Create; - ATableRequestInfoArray := TableRequestInfoArray.Create; - AWhereBuilder := TDAWhereBuilder.Create; - try - ATableNameArray.Add('Clientes'); - ATableRequestInfo := TableRequestInfoV5.Create; - - with ATableRequestInfo do - begin - IncludeSchema := True; - MaxRecords := -1; - UserFilter := ''; - - AWhereBuilder.Clear; - with AWhereBuilder do - for i := 0 to FListaIDClientes.Count - 1 do - begin - ACondicion := NewBinaryExpression( - NewBinaryExpression(NewField('', 'ID'), NewConstant(FListaIDClientes[i], datInteger), dboEqual), - NewBinaryExpression(NewField('', 'ID_EMPRESA'), NewConstant(FIdEmpresa, datInteger), dboEqual), - dboAnd); - - if not AWhereBuilder.IsEmpty then - Expression := NewBinaryExpression(Expression, ACondicion, dboOr) - else - Expression := ACondicion; - end; - - WhereClause := AWhereBuilder.ExpressionToXmlNode(AWhereBuilder.Expression); - end; - - try - ATableRequestInfoArray.Add(ATableRequestInfo); - AStream := AContactosService.GetData(ATableNameArray, ATableRequestInfoArray); - if Assigned(AStream) then - begin - ADataTable := TDAMemDataTable.Create(nil); - try - ADataTable.Name := 'Clientes'; - ADataTable.LocalDataStreamer := Bin2DataStreamer; - ADataTable.RemoteFetchEnabled := False; - Bin2DataStreamer.ReadDataset(AStream, ADataTable, True); - - ADataTable.Open; - FListaNombresClientes.Clear; - for i := 0 to ADataTable.RecordCount - 1 do - begin - FListaNombresClientes.Add(ADataTable.FieldByName('NOMBRE').AsString); - ADataTable.Next; - end; - - finally - FreeANDNil(ADataTable); - end; - end; - except - on e: Exception do - dmServer.EscribirLog(e.Message); - end; - finally - FreeANDNIL(ATableRequestInfoArray); - FreeANDNIL(ATableNameArray); - FreeANDNIL(AWhereBuilder); - end; - end; -end; - procedure TRptFacturasProforma._GenerarFactura(const ID: Integer; const VerSello: Boolean = True; const VerCopia: Boolean = True); var AInforme: Variant; @@ -1029,58 +200,22 @@ begin try tbl_Cabecera.Active := False; tbl_Detalles.Active := False; - tbl_Vencimientos.Active := False; tbl_Cabecera.ParamByName('ID').AsInteger := ID; tbl_Detalles.ParamByName('ID_FACTURA').AsInteger := ID; - tbl_Vencimientos.ParamByName('ID_FACTURA').AsInteger := ID; tbl_Cabecera.Active := True; tbl_Detalles.Active := True; - tbl_Vencimientos.Active := True; - AInforme := DarRutaFichero(DarRutaInformes, rptFacturaCliente, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString); + AInforme := DarRutaFichero(DarRutaInformes, rptFacturaProforma, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString); if VarIsNull(AInforme) then - raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe ' + rptFacturaCliente)); + raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe ' + rptFacturaProforma)); frxReport.LoadFromFile(AInforme, True); - -// if VerSello then -// frxReport.Variables.Variables['ShowLogotipo'] := VerSello; -// else -// frxReport.Variables.Variables['ShowLogotipo'] := 0; - //La primera impresion siempre es sin la etiqueta copia -// frxReport.Variables.Variables['VerCopia'] := 0; - frxReport.PrepareReport(False); -// frxReport.PreviewPages.Print; -{ - if VerCopia then - begin - frxReport.Variables.Variables['VerCopia'] := 1; - frxReport.Variables.Variables['VerSello'] := 0; //El sello nunca saldrá en la copia - frxReport.PrepareReport(False); - end; -} finally FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO" end; end; -function TRptFacturasProforma._GenerarInforme(const TipoInforme: String): Binary; -var - AInforme: Variant; -begin - Result := Binary.Create; - AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(FIdEmpresa)); - if VarIsNull(AInforme) then - raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme)); - - frxReport.LoadFromFile(AInforme, True); - IniciarParametrosInforme; - - frxReport.PrepareReport(False); - frxReport.PreviewPages.SaveToStream(Result); -end; - end. diff --git a/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.dfm b/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.dfm index 2d9d423..bc768bb 100644 --- a/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.dfm +++ b/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.dfm @@ -197,8 +197,16 @@ object srvFacturasProforma: TsrvFacturasProforma TableField = 'ID_FACTURA_FINAL' end item - DatasetField = 'REFERENCIA_CLIENTE' - TableField = 'REFERENCIA_CLIENTE' + DatasetField = 'REFERENCIA_PEDIDO_CLIENTE' + TableField = 'REFERENCIA_PEDIDO_CLIENTE' + end + item + DatasetField = 'REFERENCIA_FACTURA_FINAL' + TableField = 'REFERENCIA_FACTURA_FINAL' + end + item + DatasetField = 'REFERENCIA_DEL_CLIENTE' + TableField = 'REFERENCIA_DEL_CLIENTE' end> end> Name = 'FacturasProforma' @@ -392,20 +400,30 @@ object srvFacturasProforma: TsrvFacturasProforma Size = 255 DictionaryEntry = 'FacturasProforma_DATOS_BANCARIOS' end - item - Name = 'REFERENCIA_CLIENTE' - DataType = datString - Size = 255 - end item Name = 'ID_PEDIDO' DataType = datInteger DictionaryEntry = 'FacturasProforma_ID_PEDIDO' end + item + Name = 'REFERENCIA_PEDIDO_CLIENTE' + DataType = datString + Size = 255 + end + item + Name = 'REFERENCIA_DEL_CLIENTE' + DataType = datString + Size = 255 + end item Name = 'ID_FACTURA_FINAL' DataType = datInteger DictionaryEntry = 'FacturasProforma_ID_FACTURA_FINAL' + end + item + Name = 'REFERENCIA_FACTURA_FINAL' + DataType = datString + Size = 255 end> end item @@ -971,12 +989,6 @@ object srvFacturasProforma: TsrvFacturasProforma Size = 255 Value = '' end - item - Name = 'REFERENCIA_CLIENTE' - DataType = datString - Size = 255 - Value = '' - end item Name = 'ID_PEDIDO' DataType = datInteger @@ -1002,18 +1014,18 @@ object srvFacturasProforma: TsrvFacturasProforma 'N,'#10' PROVINCIA,'#10' CODIGO_POSTAL,'#10' FECHA_ALTA,'#10' FECHA_M' + 'ODIFICACION,'#10' USUARIO,'#10' ID_FORMA_PAGO,'#10' RECARGO_EQUIVAL' + 'ENCIA,'#10' ID_TIPO_IVA,'#10' IMPORTE_NETO,'#10' IMPORTE_PORTE,'#10' ' + - ' DATOS_BANCARIOS,'#10' REFERENCIA_CLIENTE,'#10' ID_PEDIDO,'#10' ID_' + - 'FACTURA_FINAL'#10' )'#10' VALUES ('#10' :ID,'#10' :ID_EMPRESA,'#10' :RE' + - 'FERENCIA,'#10' :FECHA_FACTURA,'#10' :FECHA_VENCIMIENTO,'#10' :SITUA' + - 'CION,'#10' :BASE_IMPONIBLE,'#10' :DESCUENTO,'#10' :IMPORTE_DESCUENT' + - 'O,'#10' :DESCRIPCION_DESCUENTO,'#10' :IVA,'#10' :IMPORTE_IVA,'#10' :' + - 'RE,'#10' :IMPORTE_RE,'#10' :IMPORTE_TOTAL,'#10' :OBSERVACIONES,'#10' ' + - ' :ID_CLIENTE,'#10' :NIF_CIF,'#10' :NOMBRE,'#10' :ID_DIRECCION,'#10' ' + - ':CALLE,'#10' :POBLACION,'#10' :PROVINCIA,'#10' :CODIGO_POSTAL,'#10' ' + - ':FECHA_ALTA,'#10' :FECHA_MODIFICACION,'#10' :USUARIO,'#10' :ID_FORM' + - 'A_PAGO,'#10' :RECARGO_EQUIVALENCIA,'#10' :ID_TIPO_IVA,'#10' :IMPORT' + - 'E_NETO,'#10' :IMPORTE_PORTE,'#10' :DATOS_BANCARIOS,'#10' :REFERENCI' + - 'A_CLIENTE,'#10' :ID_PEDIDO,'#10' :ID_FACTURA_FINAL);'#10 + ' DATOS_BANCARIOS,'#10' ID_PEDIDO,'#10' ID_FACTURA_FINAL'#10' )'#10' VA' + + 'LUES ('#10' :ID,'#10' :ID_EMPRESA,'#10' :REFERENCIA,'#10' :FECHA_FAC' + + 'TURA,'#10' :FECHA_VENCIMIENTO,'#10' :SITUACION,'#10' :BASE_IMPONIBL' + + 'E,'#10' :DESCUENTO,'#10' :IMPORTE_DESCUENTO,'#10' :DESCRIPCION_DESC' + + 'UENTO,'#10' :IVA,'#10' :IMPORTE_IVA,'#10' :RE,'#10' :IMPORTE_RE,'#10' ' + + ' :IMPORTE_TOTAL,'#10' :OBSERVACIONES,'#10' :ID_CLIENTE,'#10' :NIF_C' + + 'IF,'#10' :NOMBRE,'#10' :ID_DIRECCION,'#10' :CALLE,'#10' :POBLACION,'#10 + + ' :PROVINCIA,'#10' :CODIGO_POSTAL,'#10' :FECHA_ALTA,'#10' :FECHA_' + + 'MODIFICACION,'#10' :USUARIO,'#10' :ID_FORMA_PAGO,'#10' :RECARGO_EQU' + + 'IVALENCIA,'#10' :ID_TIPO_IVA,'#10' :IMPORTE_NETO,'#10' :IMPORTE_POR' + + 'TE,'#10' :DATOS_BANCARIOS,'#10' :ID_PEDIDO,'#10' :ID_FACTURA_FINAL)' + + ';'#10 StatementType = stSQL ColumnMappings = <> end> @@ -1192,12 +1204,6 @@ object srvFacturasProforma: TsrvFacturasProforma Size = 255 Value = '' end - item - Name = 'REFERENCIA_CLIENTE' - DataType = datString - Size = 255 - Value = '' - end item Name = 'ID_PEDIDO' DataType = datInteger @@ -1233,9 +1239,9 @@ object srvFacturasProforma: TsrvFacturasProforma 'IO = :USUARIO,'#10' ID_FORMA_PAGO = :ID_FORMA_PAGO,'#10' RECARGO_E' + 'QUIVALENCIA = :RECARGO_EQUIVALENCIA,'#10' ID_TIPO_IVA = :ID_TIPO_' + 'IVA,'#10' IMPORTE_NETO = :IMPORTE_NETO,'#10' IMPORTE_PORTE = :IMPO' + - 'RTE_PORTE,'#10' DATOS_BANCARIOS = :DATOS_BANCARIOS,'#10' REFERENCI' + - 'A_CLIENTE = :REFERENCIA_CLIENTE,'#10' ID_PEDIDO = :ID_PEDIDO,'#10' ' + - ' ID_FACTURA_FINAL = :ID_FACTURA_FINAL'#10' WHERE'#10' (ID = :OLD_ID);'#10 + 'RTE_PORTE,'#10' DATOS_BANCARIOS = :DATOS_BANCARIOS,'#10' ID_PEDIDO' + + ' = :ID_PEDIDO,'#10' ID_FACTURA_FINAL = :ID_FACTURA_FINAL'#10' WHERE'#10 + + ' (ID = :OLD_ID);'#10 StatementType = stSQL ColumnMappings = <> end> diff --git a/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.pas b/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.pas index 06097c7..b152afb 100644 --- a/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.pas +++ b/Source/Modulos/Facturas proforma/Servidor/srvFacturasProforma_Impl.pas @@ -46,8 +46,7 @@ implementation uses {Generated:} FactuGES_Invk, Dialogs, uSistemaFunc, uROClasses, uDataModuleServer, uDatabaseUtils, uUsersManager, schFacturasProformaClient_Intf, - uRestriccionesUsuarioUtils, - uBizFacturasProformaServer; //, uRptFacturasProforma_Server; + uRestriccionesUsuarioUtils, uBizFacturasProformaServer, uRptFacturasProforma_Server; procedure Create_srvFacturasProforma(out anInstance : IUnknown); begin @@ -87,31 +86,27 @@ begin end; function TsrvFacturasProforma.GenerarInformeEnPDF(const ListaID: TIntegerArray): Binary; -//var -// AReportGenerator : TRptFacturasProforma; +var + AReportGenerator : TRptFacturasProforma; begin -{ AReportGenerator := TRptFacturasProforma.Create(nil); try Result := AReportGenerator.GenerarFacturaEnPDF(ListaID); finally FreeAndNIL(AReportGenerator); end; -} end; function TsrvFacturasProforma.GenerarInforme(const ListaID: TIntegerArray): Binary; -//var -// AReportGenerator : TRptFacturasProforma; +var + AReportGenerator : TRptFacturasProforma; begin -{ AReportGenerator := TRptFacturasProforma.Create(nil); try Result := AReportGenerator.GenerarFactura(ListaID); finally FreeAndNIL(AReportGenerator); end; - } end; initialization diff --git a/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dpk b/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dpk index 9d79649..fedaa7a 100644 --- a/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dpk +++ b/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dpk @@ -66,7 +66,8 @@ requires JvCoreD11R, JvSystemD11R, JvPageCompsD11R, - Articulos_view; + Articulos_view, + FacProforma_FacCli_relation; contains uFacturasProformaViewRegister in 'uFacturasProformaViewRegister.pas', diff --git a/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dproj b/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dproj index 274e01a..450381f 100644 --- a/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dproj +++ b/Source/Modulos/Facturas proforma/Views/FacturasProforma_view.dproj @@ -68,6 +68,7 @@ + diff --git a/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.dfm b/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.dfm index a9d77ca..c3e41ef 100644 --- a/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.dfm +++ b/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.dfm @@ -240,28 +240,28 @@ inherited fEditorFacturaProforma: TfEditorFacturaProforma ExplicitHeight = 290 inherited ToolBar1: TToolBar Width = 809 - Height = 51 + Height = 46 ExplicitWidth = 809 - ExplicitHeight = 51 + ExplicitHeight = 46 inherited ToolButton3: TToolButton Wrap = False end inherited ToolButton4: TToolButton Left = 278 Top = 0 + Wrap = True ExplicitLeft = 278 ExplicitTop = 0 end - inherited FontName: TJvFontComboBox - Left = 334 - Top = 0 - ExplicitLeft = 334 - ExplicitTop = 0 - end inherited ToolButton14: TToolButton - Left = 479 - Top = 0 - ExplicitLeft = 479 + Left = 0 + Wrap = False + ExplicitLeft = 0 + end + inherited FontName: TJvFontComboBox + Left = 65 + Top = 22 + ExplicitLeft = 399 ExplicitTop = 0 end inherited FontSize: TEdit @@ -286,49 +286,46 @@ inherited fEditorFacturaProforma: TfEditorFacturaProforma ExplicitTop = 0 ExplicitHeight = 27 end - inherited ToolButton11: TToolButton + inherited ToolButton6: TToolButton Left = 0 Top = 27 ExplicitLeft = 0 ExplicitTop = 27 end - inherited ToolButton12: TToolButton - Left = 141 - Top = 27 - Wrap = False - ExplicitLeft = 141 - ExplicitTop = 27 - ExplicitHeight = 22 - end - inherited ToolButton9: TToolButton - Left = 149 - Top = 27 - ExplicitLeft = 149 - ExplicitTop = 27 - end - inherited ToolButton10: TToolButton - Left = 294 - Top = 27 - ExplicitLeft = 294 - ExplicitTop = 27 - end - inherited ToolButton6: TToolButton - Left = 419 - Top = 27 - ExplicitLeft = 419 - ExplicitTop = 27 - end inherited ToolButton7: TToolButton - Left = 485 + Left = 66 Top = 27 - Wrap = False - ExplicitLeft = 485 + ExplicitLeft = 66 ExplicitTop = 27 end inherited ToolButton8: TToolButton - Left = 552 + Left = 133 Top = 27 - ExplicitLeft = 552 + ExplicitLeft = 133 + ExplicitTop = 27 + end + inherited ToolButton12: TToolButton + Left = 216 + Top = 27 + ExplicitLeft = 216 + ExplicitTop = 27 + end + inherited ToolButton9: TToolButton + Left = 224 + Top = 27 + ExplicitLeft = 224 + ExplicitTop = 27 + end + inherited ToolButton10: TToolButton + Left = 369 + Top = 27 + ExplicitLeft = 369 + ExplicitTop = 27 + end + inherited ToolButton11: TToolButton + Left = 494 + Top = 27 + ExplicitLeft = 494 ExplicitTop = 27 end end diff --git a/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.pas b/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.pas index c70b5f6..547594f 100644 --- a/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.pas +++ b/Source/Modulos/Facturas proforma/Views/uEditorFacturaProforma.pas @@ -328,7 +328,7 @@ begin AVerCopia := True; //Preguntamos si desea que en las facturas se vea el Sello - if ElegirOpcionesImpresionFacturaProforma(AVerSello, AVerCopia) then +// if ElegirOpcionesImpresionFacturaProforma(AVerSello, AVerCopia) then FController.Print(FFactura, AllItems, AVerSello, AVerCopia); end; @@ -406,7 +406,7 @@ begin AVerCopia := True; //Preguntamos si desea que en las facturas se vea el Sello - if ElegirOpcionesImpresionFacturaProforma(AVerSello, AVerCopia) then +// if ElegirOpcionesImpresionFacturaProforma(AVerSello, AVerCopia) then FController.Preview(FFactura, AllItems, AVerSello, AVerCopia); end; diff --git a/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.dfm b/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.dfm index 79f5b7d..ca03869 100644 --- a/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.dfm +++ b/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.dfm @@ -41,6 +41,7 @@ inherited fEditorFacturasProforma: TfEditorFacturasProforma ExplicitWidth = 842 inherited TBXItem2: TTBXItem Action = actNuevaFactura + ImageIndex = 22 end object TBXItem40: TTBXItem [13] Action = actEnviarEMail @@ -64,7 +65,13 @@ inherited fEditorFacturasProforma: TfEditorFacturasProforma end inherited TBXTMain2: TTBXToolbar Left = 427 + Visible = True ExplicitLeft = 427 + ExplicitWidth = 117 + object TBXItem38: TTBXItem + Action = actGenerarFactura + DisplayMode = nbdmImageAndText + end end end inherited StatusBar: TJvStatusBar @@ -213,6 +220,13 @@ inherited fEditorFacturasProforma: TfEditorFacturasProforma OnExecute = actEnviarEMailExecute OnUpdate = actEnviarEMailUpdate end + object actGenerarFactura: TAction + Category = 'Archivo' + Caption = 'Generar factura' + ImageIndex = 25 + OnExecute = actGenerarFacturaExecute + OnUpdate = actGenerarFacturaUpdate + end end inherited SmallImages: TPngImageList [5] PngImages = < @@ -937,6 +951,25 @@ inherited fEditorFacturasProforma: TfEditorFacturasProforma 064200A70120096201BA0100A6C62916A56F74520000000049454E44AE426082} Name = 'PngImage24' Background = clWindow + end + item + PngImage.Data = { + 89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF + 61000000097048597300000B3A00000B3A01647F570D0000015D4944415478DA + 63FCFFFF3F030830323232C0C0CEB58DCA2F6E6CBDF3FEF129B818C30F061490 + 3FFF3F58032336032E9C58FD9F8B47904155DB192EF6FFD72B867F9F2F31FCB9 + E3CA3063061E0380B6DBB373F01CB076CD66606165C7AAB96001923E6403809A + 9979F925FEC8299B32482B18E2D40C16C7614032D08039164EA97017810CF875 + 5E1CAC196F18EC5AD7C40F74FA073DB36006411179B8E6FF3F5F32FCBEA687A2 + 196B18000D681797D6AAD06008852B64D5BA0434E4251833000DFBFBA2087718 + 2CEF76FFFFE1E119865F5FDF81F9B993706BC61906D0589056D7D07F2223CE8D + 53332103DAC5C4A52B749438706AC6170BECACAC6C3FF4547918F8397FE3D48C + 3F1A79F9E7982A7F66F8FBBA16A7669C061CDB35E1BF9CAA1D83C84B23BC9AB1 + 1A008C466BA0F38F5888D632CC9AF907AF66AC065C383AF73FC7B7150C3B97ED + 21A819AB0137CE2CFBBF776E2643CE8C4F0435231B00004A4C11F0D3652A8300 + 00000049454E44AE426082} + Name = 'PngImage25' + Background = clWindow end> Left = 395 Bitmap = {} diff --git a/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.pas b/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.pas index b32d468..b8f7956 100644 --- a/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.pas +++ b/Source/Modulos/Facturas proforma/Views/uEditorFacturasProforma.pas @@ -36,12 +36,16 @@ type Enviarporemail1: TMenuItem; JSInformesDialog: TJSDialog; frViewFacturasProforma1: TfrViewFacturasProforma; + actGenerarFactura: TAction; + TBXItem38: TTBXItem; procedure FormShow(Sender: TObject); procedure actEliminarUpdate(Sender: TObject); procedure actNuevaFacturaExecute(Sender: TObject); procedure actEnviarEMailUpdate(Sender: TObject); procedure actEnviarEMailExecute(Sender: TObject); procedure OnListaAnosChange(Sender: TObject; const Text: string); + procedure actGenerarFacturaExecute(Sender: TObject); + procedure actGenerarFacturaUpdate(Sender: TObject); private FFacturas: IBizFacturaProforma; @@ -75,10 +79,10 @@ implementation uses uDataModuleFacturasProforma, uDataModuleUsuarios, uFactuGES_App, -// uAlbaranesClienteController, uGenerarFacturasCliAlbCliUtils, //uGenerarFacturasCliPreCliUtils, +// uAlbaranesClienteController, //uGenerarFacturasCliPreCliUtils, // uBizAlbaranesCliente, uGestorInformesController, uDialogOpcionesImpresionFacturasProforma, uEditorBase, uGridStatusUtils, - uDBSelectionListUtils, udialogUtils; + uDBSelectionListUtils, udialogUtils, uGenerarFacturasCliFacProformaUtils; {$R *.dfm} @@ -127,6 +131,22 @@ begin (Sender as TAction).Enabled := False; end; +procedure TfEditorFacturasProforma.actGenerarFacturaExecute(Sender: TObject); +begin + GenerarFacturaCliFacProforma(Facturas.ID); + actRefrescar.Execute; +end; + +procedure TfEditorFacturasProforma.actGenerarFacturaUpdate(Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := HayDatos and + not (ViewGrid.NumSeleccionados > 1) and + ViewGrid.esSeleccionCeldaDatos and + ((FFacturas.ID_FACTURA_FINAL = 0)); + +end; + procedure TfEditorFacturasProforma.actNuevaFacturaExecute(Sender: TObject); begin actNuevo.Execute; diff --git a/Source/Modulos/Facturas proforma/Views/uFacturasProformaViewRegister.pas b/Source/Modulos/Facturas proforma/Views/uFacturasProformaViewRegister.pas index f4c4f60..1efcd98 100644 --- a/Source/Modulos/Facturas proforma/Views/uFacturasProformaViewRegister.pas +++ b/Source/Modulos/Facturas proforma/Views/uFacturasProformaViewRegister.pas @@ -21,7 +21,7 @@ begin EditorRegistry.RegisterClass(TfEditorElegirFacturasProforma, 'EditorElegirFacturasProforma'); EditorRegistry.RegisterClass(TfEditorFacturasProformaPreview, 'EditorFacturasProformaPreview'); EditorRegistry.RegisterClass(TfDialogOpcionesImpresionFacturasProforma, 'DialogOpcionesImpresionFacturasProforma'); - EditorRegistry.RegisterClass(TfDialogListaFacturasProformaEnvioEMail, 'DialogListaFacturasEnvioEMail'); + EditorRegistry.RegisterClass(TfDialogListaFacturasProformaEnvioEMail, 'DialogListaFacturasProformaEnvioEMail'); end; procedure UnregisterViews; diff --git a/Source/Modulos/Facturas proforma/Views/uViewFacturaProforma.dfm b/Source/Modulos/Facturas proforma/Views/uViewFacturaProforma.dfm index 57af1cc..42e777f 100644 --- a/Source/Modulos/Facturas proforma/Views/uViewFacturaProforma.dfm +++ b/Source/Modulos/Facturas proforma/Views/uViewFacturaProforma.dfm @@ -1,6 +1,6 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma - Width = 992 - Height = 644 + Width = 451 + Height = 304 Align = alClient OnCreate = CustomViewCreate OnDestroy = CustomViewDestroy @@ -9,19 +9,17 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma object dxLayoutControl1: TdxLayoutControl Left = 0 Top = 0 - Width = 992 - Height = 644 + Width = 451 + Height = 304 Align = alClient ParentBackground = True TabOrder = 0 TabStop = False AutoContentSizes = [acsWidth, acsHeight] LookAndFeel = dxLayoutOfficeLookAndFeel1 - ExplicitWidth = 451 - ExplicitHeight = 304 DesignSize = ( - 992 - 644) + 451 + 304) object eReferencia: TcxDBTextEdit Left = 124 Top = 30 @@ -132,7 +130,7 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma Width = 269 end object bFormasPago: TButton - Left = 416 + Left = 172 Top = 103 Width = 132 Height = 23 @@ -189,7 +187,7 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma Width = 275 end inline frViewDatosYSeleccionClienteFacturaProforma1: TfrViewDatosYSeleccionClienteFacturaProforma - Left = 587 + Left = 343 Top = 36 Width = 387 Height = 180 @@ -201,14 +199,15 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma ParentFont = False TabOrder = 6 ReadOnly = False - ExplicitLeft = 587 + ExplicitLeft = 343 ExplicitTop = 36 ExplicitWidth = 387 ExplicitHeight = 180 inherited dxLayoutControl1: TdxLayoutControl Width = 387 Height = 180 - ExplicitWidth = 101 + ExplicitWidth = 387 + ExplicitHeight = 180 DesignSize = ( 387 180) @@ -221,20 +220,20 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma Width = 224 end inherited edtNIFCIF: TcxDBTextEdit - Left = 270 + Left = 171 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitLeft = 270 + ExplicitLeft = 171 end inherited Button3: TBitBtn - Left = 181 - ExplicitLeft = 181 + Left = 82 + ExplicitLeft = 82 end inherited Button4: TButton - Left = 350 - ExplicitLeft = 350 + Left = 251 + ExplicitLeft = 251 end inherited edtDireccion: TcxMemo Style.LookAndFeel.SkinName = '' @@ -307,7 +306,6 @@ inherited frViewFacturaProforma: TfrViewFacturaProforma end object dxLayoutControl1Item3: TdxLayoutItem Caption = 'Cuenta bancaria:' - Visible = False Control = cbCuentaBancaria ControlOptions.ShowBorder = False end diff --git a/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.dfm b/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.dfm index 9ff16f2..75da48b 100644 --- a/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.dfm +++ b/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.dfm @@ -166,6 +166,27 @@ inherited frViewFacturasProforma: TfrViewFacturasProforma HeaderAlignmentHorz = taRightJustify Width = 128 end + object cxGridViewREFERENCIA_PEDIDO_CLIENTE: TcxGridDBColumn + Caption = 'Ref. Pedido Cliente' + DataBinding.FieldName = 'REFERENCIA_PEDIDO_CLIENTE' + PropertiesClassName = 'TcxTextEditProperties' + Properties.Alignment.Horz = taRightJustify + HeaderAlignmentHorz = taRightJustify + end + object cxGridViewREFERENCIA_DEL_CLIENTE: TcxGridDBColumn + Caption = 'Ref. ped. del cliente' + DataBinding.FieldName = 'REFERENCIA_DEL_CLIENTE' + PropertiesClassName = 'TcxTextEditProperties' + Properties.Alignment.Horz = taRightJustify + HeaderAlignmentHorz = taRightJustify + end + object cxGridViewREFERENCIA_FACTURA_FINAL: TcxGridDBColumn + Caption = 'Ref. factura cliente' + DataBinding.FieldName = 'REFERENCIA_FACTURA_FINAL' + PropertiesClassName = 'TcxTextEditProperties' + Properties.Alignment.Horz = taRightJustify + HeaderAlignmentHorz = taRightJustify + end end inherited cxGridLevel: TcxGridLevel Caption = 'Todas' diff --git a/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.pas b/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.pas index 5679a5f..c1d9d8a 100644 --- a/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.pas +++ b/Source/Modulos/Facturas proforma/Views/uViewFacturasProforma.pas @@ -56,6 +56,9 @@ type cxGridViewFECHA_VENCIMIENTO: TcxGridDBColumn; cxGridViewRE: TcxGridDBColumn; cxGridViewIMPORTE_RE: TcxGridDBColumn; + cxGridViewREFERENCIA_PEDIDO_CLIENTE: TcxGridDBColumn; + cxGridViewREFERENCIA_FACTURA_FINAL: TcxGridDBColumn; + cxGridViewREFERENCIA_DEL_CLIENTE: TcxGridDBColumn; procedure cxGridViewStylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); diff --git a/Source/Modulos/Informe margen por articulo/Data/InfMargenArticulo_data.drc b/Source/Modulos/Informe margen por articulo/Data/InfMargenArticulo_data.drc index 0bd665a..871aebe 100644 --- a/Source/Modulos/Informe margen por articulo/Data/InfMargenArticulo_data.drc +++ b/Source/Modulos/Informe margen por articulo/Data/InfMargenArticulo_data.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Informe margen por articulo\Data\uDataModuleInfMargenArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe margen por articulo\Data\InfMargenArticulo_data.res */ -/* c:\temp\dtf2FC.tmp */ +/* c:\temp\dtf338.tmp */ diff --git a/Source/Modulos/Informe margen por articulo/Model/InfMargenArticulo_model.drc b/Source/Modulos/Informe margen por articulo/Model/InfMargenArticulo_model.drc index 294db4c..d45cce3 100644 --- a/Source/Modulos/Informe margen por articulo/Model/InfMargenArticulo_model.drc +++ b/Source/Modulos/Informe margen por articulo/Model/InfMargenArticulo_model.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Informe margen por articulo\Model\InfMargenArticulo_model.res */ -/* c:\temp\dtf2FA.tmp */ +/* c:\temp\dtf336.tmp */ diff --git a/Source/Modulos/Informe margen por articulo/Views/InfMargenArticulo_view.drc b/Source/Modulos/Informe margen por articulo/Views/InfMargenArticulo_view.drc index 6319fcd..7023121 100644 --- a/Source/Modulos/Informe margen por articulo/Views/InfMargenArticulo_view.drc +++ b/Source/Modulos/Informe margen por articulo/Views/InfMargenArticulo_view.drc @@ -16,4 +16,4 @@ END /* C:\Codigo\Source\Modulos\Informe margen por articulo\Views\uViewInfMargenArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe margen por articulo\Views\uEditorInfMargenArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe margen por articulo\Views\InfMargenArticulo_view.res */ -/* c:\temp\dtf300.tmp */ +/* c:\temp\dtf33C.tmp */ diff --git a/Source/Modulos/Informe ventas por articulo/Data/InfVentasArticulo_data.drc b/Source/Modulos/Informe ventas por articulo/Data/InfVentasArticulo_data.drc index 9eaf364..513362d 100644 --- a/Source/Modulos/Informe ventas por articulo/Data/InfVentasArticulo_data.drc +++ b/Source/Modulos/Informe ventas por articulo/Data/InfVentasArticulo_data.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Data\uDataModuleInfVentasArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Data\InfVentasArticulo_data.res */ -/* c:\temp\dtf2F2.tmp */ +/* c:\temp\dtf32E.tmp */ diff --git a/Source/Modulos/Informe ventas por articulo/Model/InfVentasArticulo_model.drc b/Source/Modulos/Informe ventas por articulo/Model/InfVentasArticulo_model.drc index 3abab03..d0e4bff 100644 --- a/Source/Modulos/Informe ventas por articulo/Model/InfVentasArticulo_model.drc +++ b/Source/Modulos/Informe ventas por articulo/Model/InfVentasArticulo_model.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Model\InfVentasArticulo_model.res */ -/* c:\temp\dtf2F0.tmp */ +/* c:\temp\dtf32C.tmp */ diff --git a/Source/Modulos/Informe ventas por articulo/Views/InfVentasArticulo_view.drc b/Source/Modulos/Informe ventas por articulo/Views/InfVentasArticulo_view.drc index 36b825a..4736e0b 100644 --- a/Source/Modulos/Informe ventas por articulo/Views/InfVentasArticulo_view.drc +++ b/Source/Modulos/Informe ventas por articulo/Views/InfVentasArticulo_view.drc @@ -19,4 +19,4 @@ END /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Views\uViewInfVentasAlbArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Views\uEditorInfVentasAlbArticulo.dfm */ /* C:\Codigo\Source\Modulos\Informe ventas por articulo\Views\InfVentasArticulo_view.res */ -/* c:\temp\dtf2F6.tmp */ +/* c:\temp\dtf332.tmp */ diff --git a/Source/Modulos/Informes base/Controller/InformesBase_controller.drc b/Source/Modulos/Informes base/Controller/InformesBase_controller.drc index 0c42196..4082db0 100644 --- a/Source/Modulos/Informes base/Controller/InformesBase_controller.drc +++ b/Source/Modulos/Informes base/Controller/InformesBase_controller.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Informes base\Controller\InformesBase_controller.res */ -/* c:\temp\dtf2E6.tmp */ +/* c:\temp\dtf322.tmp */ diff --git a/Source/Modulos/Informes base/Data/Informes_data.drc b/Source/Modulos/Informes base/Data/Informes_data.drc index 840d78b..c881353 100644 --- a/Source/Modulos/Informes base/Data/Informes_data.drc +++ b/Source/Modulos/Informes base/Data/Informes_data.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Informes base\Data\uDataModuleInformes.dfm */ /* C:\Codigo\Source\Modulos\Informes base\Data\Informes_data.res */ -/* c:\temp\dtf2E0.tmp */ +/* c:\temp\dtf31E.tmp */ diff --git a/Source/Modulos/Informes base/Model/Informes_model.drc b/Source/Modulos/Informes base/Model/Informes_model.drc index 409682f..d7ff84c 100644 --- a/Source/Modulos/Informes base/Model/Informes_model.drc +++ b/Source/Modulos/Informes base/Model/Informes_model.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Informes base\Model\Informes_model.res */ -/* c:\temp\dtf2DE.tmp */ +/* c:\temp\dtf31C.tmp */ diff --git a/Source/Modulos/Informes base/Views/Informes_view.drc b/Source/Modulos/Informes base/Views/Informes_view.drc index cf7298a..37c9888 100644 --- a/Source/Modulos/Informes base/Views/Informes_view.drc +++ b/Source/Modulos/Informes base/Views/Informes_view.drc @@ -15,4 +15,4 @@ END /* C:\Codigo\Source\Modulos\Informes base\Views\uViewInformes.dfm */ /* C:\Codigo\Source\Modulos\Informes base\Views\uEditorInformes.dfm */ /* C:\Codigo\Source\Modulos\Informes base\Views\Informes_view.res */ -/* c:\temp\dtf2EA.tmp */ +/* c:\temp\dtf326.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.drc b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.drc index 7d42f8f..d0f037c 100644 --- a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.drc +++ b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Pedidos de cliente\Controller\PedidosCliente_controller.RES */ -/* c:\temp\dtf37A.tmp */ +/* c:\temp\dtf3B6.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.drc b/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.drc index 6b49c8d..0a9ae72 100644 --- a/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.drc +++ b/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Pedidos de cliente\Data\uDataModulePedidosCliente.dfm */ /* C:\Codigo\Source\Modulos\Pedidos de cliente\Data\PedidosCliente_data.RES */ -/* c:\temp\dtf324.tmp */ +/* c:\temp\dtf360.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/Model/PedidosCliente_model.drc b/Source/Modulos/Pedidos de cliente/Model/PedidosCliente_model.drc index b817d79..b528fbb 100644 --- a/Source/Modulos/Pedidos de cliente/Model/PedidosCliente_model.drc +++ b/Source/Modulos/Pedidos de cliente/Model/PedidosCliente_model.drc @@ -13,4 +13,4 @@ BEGIN END /* C:\Codigo\Source\Modulos\Pedidos de cliente\Model\PedidosCliente_model.RES */ -/* c:\temp\dtf322.tmp */ +/* c:\temp\dtf35E.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.groupproj b/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.groupproj index cc7d104..576ac24 100644 --- a/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.groupproj +++ b/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.groupproj @@ -23,6 +23,7 @@ + @@ -34,6 +35,7 @@ + @@ -381,14 +383,32 @@ + + + + + + + + + + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Pedidos de cliente/Plugin/PedidosCliente_plugin.drc b/Source/Modulos/Pedidos de cliente/Plugin/PedidosCliente_plugin.drc index 6f635e7..1e3900b 100644 --- a/Source/Modulos/Pedidos de cliente/Plugin/PedidosCliente_plugin.drc +++ b/Source/Modulos/Pedidos de cliente/Plugin/PedidosCliente_plugin.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Pedidos de cliente\Plugin\uPluginPedidosCliente.dfm */ /* C:\Codigo\Source\Modulos\Pedidos de cliente\Plugin\PedidosCliente_plugin.RES */ -/* c:\temp\dtf394.tmp */ +/* c:\temp\dtf3D4.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dpk b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dpk index 544eb11..c29b3a1 100644 --- a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dpk +++ b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dpk @@ -85,7 +85,8 @@ requires Almacenes_model, Almacenes_controller, PedCli_PedProv_relation, - PedidosProveedor_model; + PedidosProveedor_model, + PedCli_FacProforma_relation; contains uPedidosClienteViewRegister in 'uPedidosClienteViewRegister.pas', diff --git a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dproj b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dproj index aaed076..8d1566a 100644 --- a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dproj +++ b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.dproj @@ -49,67 +49,68 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
frDialogListaPedidosClienteEnvioEMail
T @@ -118,10 +119,6 @@
fDialogOpcionesImpresionPedidosCliente
TfEditorPedidosProveedor
- - TfEditorPedidosProveedor -
fDialogOpcionesProcesoPedidoCliente
-
frEditorDireccionEntregaPedidoCliente
TForm diff --git a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.drc b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.drc index 5d4d06d..2ab33c5 100644 --- a/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.drc +++ b/Source/Modulos/Pedidos de cliente/Views/PedidosCliente_view.drc @@ -26,4 +26,4 @@ END /* C:\Codigo\Source\Modulos\Pedidos de cliente\Views\uEditorElegirArticulosPedidoCliente.dfm */ /* C:\Codigo\Source\Modulos\Pedidos de cliente\Views\uEditorDireccionEntregaPedidoCliente.dfm */ /* C:\Codigo\Source\Modulos\Pedidos de cliente\Views\PedidosCliente_view.RES */ -/* c:\temp\dtf392.tmp */ +/* c:\temp\dtf3D2.tmp */ diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm index 3d94d84..9c660c4 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm @@ -2,17 +2,17 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente Left = 411 Top = 346 Caption = 'Lista de pedidos de cliente' - ClientWidth = 700 + ClientWidth = 956 Position = poDesigned - ExplicitWidth = 708 + ExplicitWidth = 964 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader - Width = 700 + Width = 956 Caption = 'Lista de pedidos de cliente' ExplicitWidth = 700 inherited Image1: TImage - Left = 673 + Left = 929 Picture.Data = { 0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001800 0000180806000000E0773DF80000000970485973000017120000171201679FD2 @@ -41,10 +41,10 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente end end inherited TBXDock: TTBXDock - Width = 700 + Width = 956 ExplicitWidth = 700 inherited tbxMain: TTBXToolbar - ExplicitWidth = 700 + ExplicitWidth = 877 object TBXItem40: TTBXItem [13] Action = actEnviarEMail end @@ -62,21 +62,35 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente end end inherited tbxMenu: TTBXToolbar - ExplicitWidth = 700 + ExplicitWidth = 956 end inherited TBXTMain2: TTBXToolbar Left = 427 Visible = True ExplicitLeft = 427 - ExplicitWidth = 209 - object TBXItem39: TTBXItem - Action = actGenerar + ExplicitWidth = 529 + object TBXItem43: TTBXItem + Action = actGenerarPedidoProv + DisplayMode = nbdmImageAndText + Images = SmallImages + end + object TBXItem44: TTBXItem + Action = actGenerarAlbaranCli + DisplayMode = nbdmImageAndText + Images = SmallImages + end + object TBXItem45: TTBXItem + Action = actGenerarFacturaProforma DisplayMode = nbdmImageAndText end object TBXItem42: TTBXItem Action = actVerProcesoCompleto DisplayMode = nbdmImageAndText end + object TBXItem39: TTBXItem + Action = actGenerar + DisplayMode = nbdmImageAndText + end object TBXItem38: TTBXItem Action = actFacturarPedido DisplayMode = nbdmImageAndText @@ -87,13 +101,13 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente end end inherited StatusBar: TJvStatusBar - Width = 700 + Width = 956 ExplicitWidth = 700 end inline frViewPedidosCliente1: TfrViewPedidosCliente [3] Left = 0 Top = 102 - Width = 700 + Width = 956 Height = 383 Align = alClient Font.Charset = DEFAULT_CHARSET @@ -108,7 +122,7 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente ExplicitWidth = 700 ExplicitHeight = 383 inherited cxGrid: TcxGrid - Width = 700 + Width = 956 Height = 255 ExplicitWidth = 700 ExplicitHeight = 255 @@ -140,12 +154,12 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente end end inherited frViewFiltroBase1: TfrViewFiltroBase - Width = 700 + Width = 956 ExplicitWidth = 700 inherited TBXDockablePanel1: TTBXDockablePanel ExplicitWidth = 700 inherited dxLayoutControl1: TdxLayoutControl - Width = 700 + Width = 956 ExplicitWidth = 700 inherited txtFiltroTodo: TcxTextEdit Style.LookAndFeel.SkinName = '' @@ -164,31 +178,31 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente Width = 243 end inherited edtFechaFinFiltro: TcxDateEdit - Left = 244 + Left = 327 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitLeft = 244 + ExplicitLeft = 327 ExplicitWidth = 482 Width = 482 end inherited eLista: TcxComboBox - Left = 605 + Left = 816 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitLeft = 605 + ExplicitLeft = 816 ExplicitWidth = 140 Width = 140 end end inherited TBXAlignmentPanel1: TTBXAlignmentPanel - Width = 700 + Width = 956 ExplicitWidth = 700 inherited tbxBotones: TTBXToolbar - Width = 690 + Width = 946 ExplicitWidth = 690 end end @@ -199,10 +213,10 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente ExplicitTop = 357 ExplicitWidth = 700 inherited TBXAlignmentPanel1: TTBXAlignmentPanel - Width = 700 + Width = 956 ExplicitWidth = 700 inherited TBXToolbar1: TTBXToolbar - Width = 690 + Width = 946 ExplicitWidth = 690 end end @@ -266,18 +280,23 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente Category = 'Acciones' Caption = 'Generar' ImageIndex = 23 + Visible = False OnExecute = actGenerarExecute OnUpdate = actGenerarUpdate end object actGenerarAlbaranCli: TAction Category = 'Acciones' Caption = 'Generar albar'#225'n de cliente' + ImageIndex = 23 OnExecute = actGenerarAlbaranCliExecute + OnUpdate = actGenerarAlbaranCliUpdate end object actGenerarPedidoProv: TAction Category = 'Acciones' Caption = 'Generar pedido a proveedor' + ImageIndex = 23 OnExecute = actGenerarPedidoProvExecute + OnUpdate = actGenerarPedidoProvUpdate end object actVerProcesoCompleto: TAction Category = 'Acciones' @@ -285,6 +304,12 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente ImageIndex = 2 OnExecute = actVerProcesoCompletoExecute end + object actGenerarFacturaProforma: TAction + Category = 'Acciones' + Caption = 'Generar factura proforma' + ImageIndex = 23 + OnExecute = actGenerarFacturaProformaExecute + end end inherited SmallImages: TPngImageList [5] PngImages = < diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas index e1fc081..45a5d6f 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas @@ -38,6 +38,10 @@ type actGenerarPedidoProv: TAction; actVerProcesoCompleto: TAction; TBXItem42: TTBXItem; + TBXItem43: TTBXItem; + TBXItem44: TTBXItem; + actGenerarFacturaProforma: TAction; + TBXItem45: TTBXItem; procedure FormShow(Sender: TObject); procedure actCambiarSituacionExecute(Sender: TObject); procedure actRecibirPedidoUpdate(Sender: TObject); @@ -54,6 +58,9 @@ type procedure actGenerarAlbaranCliExecute(Sender: TObject); procedure actGenerarPedidoProvExecute(Sender: TObject); procedure actVerProcesoCompletoExecute(Sender: TObject); + procedure actGenerarAlbaranCliUpdate(Sender: TObject); + procedure actGenerarPedidoProvUpdate(Sender: TObject); + procedure actGenerarFacturaProformaExecute(Sender: TObject); protected FPedidos: IBizPedidoCliente; @@ -86,7 +93,7 @@ implementation uses uDataModulePedidosCliente, uDataModuleUsuarios, uFactuGES_App, uEditorDBBase, -// uGenerarFacturasProvPedUtils, + uGenerarFacturasProformaUtils, // uInventarioController, uBizInventario, uDialogUtils, uGridStatusUtils, uDBSelectionListUtils, cxControls, uDialogOpcionesImpresionPedidosCliente, @@ -178,6 +185,15 @@ begin GenerarAlbaranCli(FPedidos.ID, IDAlbaranAux); end; +procedure TfEditorPedidosCliente.actGenerarAlbaranCliUpdate(Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := HayDatos and + not (ViewGrid.NumSeleccionados > 1) and + ViewGrid.esSeleccionCeldaDatos and + ((FPedidos.SITUACION <> SITUACION_PEDIDO_SERVIDO) and (FPedidos.SITUACION <> SITUACION_PEDIDO_ALBARANADO)); +end; + procedure TfEditorPedidosCliente.actGenerarExecute(Sender: TObject); var Respuesta : Integer; @@ -202,12 +218,27 @@ begin end; +procedure TfEditorPedidosCliente.actGenerarFacturaProformaExecute(Sender: TObject); +begin + inherited; + GenerarFacturaProforma(FPedidos.ID); +end; + procedure TfEditorPedidosCliente.actGenerarPedidoProvExecute(Sender: TObject); begin inherited; GenerarPedidosProv(FPedidos); end; +procedure TfEditorPedidosCliente.actGenerarPedidoProvUpdate(Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := HayDatos and + not (ViewGrid.NumSeleccionados > 1) and + ViewGrid.esSeleccionCeldaDatos and + ((FPedidos.SITUACION <> SITUACION_PEDIDO_SERVIDO) and (FPedidos.SITUACION <> SITUACION_PEDIDO_ALBARANADO)); +end; + procedure TfEditorPedidosCliente.actGenerarUpdate(Sender: TObject); begin inherited; diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dpk b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dpk index 4dcb4b3..5986f84 100644 Binary files a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dpk and b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dpk differ diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dproj b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dproj index bf3775c..bdfc45f 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dproj +++ b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.dproj @@ -57,6 +57,8 @@ + + diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.drc b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.drc index ff104c3..e945240 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.drc +++ b/Source/Modulos/ProcesoPresupuestoCliente/Controller/ProcesoPresupuestosCliente_controller.drc @@ -12,5 +12,5 @@ STRINGTABLE BEGIN END -/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Controller\ProcesoPresupuestosCliente_controller.RES */ -/* c:\temp\dtf3C8.tmp */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Controller\ProcesoPresupuestosCliente_controller.res */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Controller\ProcesoPresupuestosCliente_controller.drf */ diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Controller/View/uIEditorProcesoPresupuestosCliente.pas b/Source/Modulos/ProcesoPresupuestoCliente/Controller/View/uIEditorProcesoPresupuestosCliente.pas index 3cd0327..f087192 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Controller/View/uIEditorProcesoPresupuestosCliente.pas +++ b/Source/Modulos/ProcesoPresupuestoCliente/Controller/View/uIEditorProcesoPresupuestosCliente.pas @@ -4,7 +4,7 @@ interface uses uEditorDBItem, uBizPedidosCliente, uBizPedidosProveedor, uBizAlbaranesProveedor, - uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente; + uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente, uBizFacturasProforma; type IEditorProcesoPresupuestosCliente = interface(IEditorDBItem) @@ -34,6 +34,10 @@ type procedure SetFacturasCliente(const Value: IBizFacturaCliente); property FacturasCliente: IBizFacturaCliente read GetFacturasCliente write SetFacturasCliente; + function GetFacturasProforma: IBizFacturaProforma; + procedure SetFacturasProforma(const Value: IBizFacturaProforma); + property FacturasProforma: IBizFacturaProforma read GetFacturasProforma write SetFacturasProforma; + end; implementation diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Controller/uProcesoPresupuestosClienteController.pas b/Source/Modulos/ProcesoPresupuestoCliente/Controller/uProcesoPresupuestosClienteController.pas index 6ff94b4..ea6381a 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Controller/uProcesoPresupuestosClienteController.pas +++ b/Source/Modulos/ProcesoPresupuestoCliente/Controller/uProcesoPresupuestosClienteController.pas @@ -11,7 +11,8 @@ uses uBizAlbaranesProveedor, uAlbaranesProveedorController, uBizFacturasProveedor, uFacturasProveedorController, uBizAlbaranesCliente, uAlbaranesClienteController, - uBizFacturasCliente, uFacturasClienteController; + uBizFacturasCliente, uFacturasClienteController, + uBizFacturasProforma, uFacturasProformaController; type IProcesoPresupuestosClienteController = interface(IControllerBase) @@ -27,6 +28,7 @@ type FFacturasProveedorController : IFacturasProveedorController; FAlbaranesClienteController : IAlbaranesClienteController; FFacturasClienteController : IFacturasClienteController; + FFacturasProformaController : IFacturasProformaController; public constructor Create; override; @@ -38,6 +40,7 @@ type function BuscarFacturasProveedor(AAlbaranesProveedor: IBizAlbaranProveedor): IBizFacturaProveedor; function BuscarAlbaranesCliente(APedidosCliente: IBizPedidoCliente): IBizAlbaranCliente; function BuscarFacturasCliente(AAlbaranesCliente: IBizAlbaranCliente): IBizFacturaCliente; + function BuscarFacturasProforma(APedidosCliente: IBizPedidoCliente): IBizFacturaProforma; procedure VerProceso(const ListaIDPresupuestosCliente: TIntegerArray); end; @@ -61,6 +64,7 @@ begin FFacturasProveedorController := TFacturasProveedorController.Create; FAlbaranesClienteController := TAlbaranesClienteController.Create; FFacturasClienteController := TFacturasClienteController.Create; + FFacturasProformaController := TFacturasProformaController.Create; end; destructor TProcesoPresupuestosClienteController.Destroy; @@ -71,6 +75,7 @@ begin FFacturasProveedorController := Nil; FAlbaranesClienteController := Nil; FFacturasClienteController := Nil; + FFacturasProformaController := Nil; inherited; end; @@ -205,6 +210,46 @@ begin end; end; +function TProcesoPresupuestosClienteController.BuscarFacturasProforma(APedidosCliente: IBizPedidoCliente): IBizFacturaProforma; +var + Condicion: TDAWhereExpression; + AArrayIdPedidosCli : Array of TDAWhereExpression; + i: Integer; + +begin + Result := FFacturasProformaController.BuscarTodos; + //Quitamos el filtro por empresa ya que no es necesario y complicaría where que hacemos a continuación, además de que puede darse el caso de haber dado de alta un pedido de proveedor con otra empresa? + Result.DataTable.DynamicWhere.Clear; + + if Assigned(Result) then + begin + //Vamos generando todos los where necesarios para cada uno de los ID de Pedido de proveedor que buscamos + // Filtrar los Presupuestos pendientes de recepcion + with Result.DataTable.DynamicWhere do + begin + APedidosCliente.Open; + SetLength(AArrayIdPedidosCli, APedidosCliente.RecordCount); + APedidosCliente.First; + i:=0; + while not APedidosCliente.EOF do + begin + AArrayIdPedidosCli[i] := NewConstant(APedidosCliente.ID, datInteger); + Inc(i); + APedidosCliente.Next; + end; + + // (ID_PEDIDO in lista IDs) (SIEMPRE HAY AL MENOS UNO) + Condicion := NewBinaryExpression(NewField('', 'ID_PEDIDO'), NewList(AArrayIdPedidosCli), dboIn); + if IsEmpty then + Expression := Condicion + else + Expression := NewBinaryExpression(Expression, Condicion, dboAnd); + + APedidosCliente.Close; + end; + end; +end; + function TProcesoPresupuestosClienteController.BuscarFacturasProveedor(AAlbaranesProveedor: IBizAlbaranProveedor): IBizFacturaProveedor; var Condicion: TDAWhereExpression; @@ -324,6 +369,7 @@ var AFacturasProveedor: IBizFacturaProveedor; AAlbaranesCliente: IBizAlbaranCliente; AFacturasCliente: IBizFacturaCliente; + AFacturasProforma: IBizFacturaProforma; begin AEditor := NIL; @@ -334,6 +380,7 @@ begin AFacturasProveedor := BuscarFacturasProveedor(AAlbaranesProveedor); AAlbaranesCliente := BuscarAlbaranesCliente(APedidosCliente); AFacturasCliente := BuscarFacturasCliente(AAlbaranesCliente); + AFacturasProforma := BuscarFacturasProforma(APedidosCliente); CreateEditor('EditorProcesoPresupuestosCLiente', IEditorProcesoPresupuestosCliente, AEditor); if Assigned(AEditor) then @@ -345,6 +392,7 @@ begin AEditor.FacturasProveedor := AFacturasProveedor; AEditor.AlbaranesCliente := AAlbaranesCliente; AEditor.FacturasCliente := AFacturasCliente; + AEditor.FacturasProforma := AFacturasProforma; AEditor.ShowModal; finally AEditor.Release; diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Plugin/ProcesoPresupuestosCliente_plugin.drc b/Source/Modulos/ProcesoPresupuestoCliente/Plugin/ProcesoPresupuestosCliente_plugin.drc index b7c5fef..a1bdde4 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Plugin/ProcesoPresupuestosCliente_plugin.drc +++ b/Source/Modulos/ProcesoPresupuestoCliente/Plugin/ProcesoPresupuestosCliente_plugin.drc @@ -13,5 +13,5 @@ BEGIN END /* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Plugin\uPluginProcesoPresupuestosCliente.dfm */ -/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Plugin\ProcesoPresupuestosCliente_plugin.RES */ -/* c:\temp\dtf3CC.tmp */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Plugin\ProcesoPresupuestosCliente_plugin.res */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Plugin\ProcesoPresupuestosCliente_plugin.drf */ diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dpk b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dpk index 5bbe441..52a6dd6 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dpk +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dpk @@ -32,7 +32,8 @@ requires AlbaranesProveedor_model, AlbaranesCliente_model, FacturasCliente_model, - FacturasProveedor_model; + FacturasProveedor_model, + FacturasProforma_model; contains uProcesoPresupuestosClienteViewRegister in 'uProcesoPresupuestosClienteViewRegister.pas', diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dproj b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dproj index 85adc0f..09e8496 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dproj +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.dproj @@ -49,14 +49,15 @@ MainSource - - - - - - - - + + + + + + + + +
fEditorProcesoPresupuestosCliente
TfEditorPedidosProveedor diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.drc b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.drc index 701ae3d..302c683 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.drc +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/ProcesoPresupuestosCliente_view.drc @@ -14,5 +14,5 @@ END /* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Views\uViewProcesoPresupuestosCliente.dfm */ /* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Views\uEditorProcesoPresupuestosCliente.dfm */ -/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Views\ProcesoPresupuestosCliente_view.RES */ -/* c:\temp\dtf3CA.tmp */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Views\ProcesoPresupuestosCliente_view.res */ +/* C:\Codigo\Source\Modulos\ProcesoPresupuestoCliente\Views\ProcesoPresupuestosCliente_view.drf */ diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/uEditorProcesoPresupuestosCliente.pas b/Source/Modulos/ProcesoPresupuestoCliente/Views/uEditorProcesoPresupuestosCliente.pas index 2a5e9bc..aa8a911 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/uEditorProcesoPresupuestosCliente.pas +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/uEditorProcesoPresupuestosCliente.pas @@ -11,7 +11,8 @@ uses JvExControls, JvNavigationPane, uIEditorProcesoPresupuestosCLiente, uCustomView, uViewBase, uViewGridBase, uViewGrid, uViewProcesoPresupuestosCliente, uBizPedidosCliente, uBizPedidosProveedor, - uBizAlbaranesProveedor, uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente; + uBizAlbaranesProveedor, uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente, + uBizFacturasProforma, Grids, DBGrids; type TfEditorProcesoPresupuestosCliente = class(TfEditorGridBase, IEditorProcesoPresupuestosCliente) @@ -24,6 +25,7 @@ type FAlbaranesProveedor: IBizAlbaranProveedor; FFacturasProveedor: IBizFacturaProveedor; FAlbaranesCliente: IBizAlbaranCliente; + FFacturasProforma: IBizFacturaProforma; FFacturasCliente: IBizFacturaCliente; function GetPedidosCliente: IBizPedidoCliente; @@ -36,6 +38,8 @@ type procedure SetFacturasProveedor(const Value: IBizFacturaProveedor); function GetAlbaranesCliente: IBizAlbaranCliente; procedure SetAlbaranesCliente(const Value: IBizAlbaranCliente); + function GetFacturasProforma: IBizFacturaProforma; + procedure SetFacturasProforma(const Value: IBizFacturaProforma); function GetFacturasCliente: IBizFacturaCliente; procedure SetFacturasCliente(const Value: IBizFacturaCliente); @@ -45,6 +49,7 @@ type property AlbaranesProveedor: IBizAlbaranProveedor read GetAlbaranesProveedor write SetAlbaranesProveedor; property FacturasProveedor: IBizFacturaProveedor read GetFacturasProveedor write SetFacturasProveedor; property AlbaranesCliente: IBizAlbaranCliente read GetAlbaranesCliente write SetAlbaranesCliente; + property FacturasProforma: IBizFacturaProforma read GetFacturasProforma write SetFacturasProforma; property FacturasCliente: IBizFacturaCliente read GetFacturasCliente write SetFacturasCliente; constructor Create(AOwner: TComponent); override; @@ -71,6 +76,7 @@ begin FAlbaranesProveedor := Nil; FFacturasProveedor := Nil; FAlbaranesCliente := Nil; + FFacturasProforma := Nil; FFacturasCliente := Nil; inherited; end; @@ -106,6 +112,10 @@ begin raise Exception.Create('No hay ninguna factura de cliente asignado'); FacturasCliente.DataTable.Active := True; + if not Assigned(FacturasProforma) then + raise Exception.Create('No hay ninguna factura proforma asignada'); + FacturasProforma.DataTable.Active := True; + ViewGrid.GotoFirst; ViewGrid.ContraerTodo; end; @@ -125,6 +135,11 @@ begin Result := FFacturasCliente; end; +function TfEditorProcesoPresupuestosCliente.GetFacturasProforma: IBizFacturaProforma; +begin + Result := FFacturasProforma; +end; + function TfEditorProcesoPresupuestosCliente.GetFacturasProveedor: IBizFacturaProveedor; begin Result := FFacturasProveedor; @@ -170,6 +185,16 @@ begin end; end; +procedure TfEditorProcesoPresupuestosCliente.SetFacturasProforma(const Value: IBizFacturaProforma); +begin + FFacturasProforma := Value; + if Assigned(FFacturasProforma) then + begin + if Assigned(ViewGrid) then + (ViewGrid as IViewListadoProcesoPedidoCliente).FacturasProforma := FacturasProforma; + end; +end; + procedure TfEditorProcesoPresupuestosCliente.SetFacturasProveedor(const Value: IBizFacturaProveedor); begin FFacturasProveedor := Value; diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.dfm b/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.dfm index 6877d7d..182215b 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.dfm +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.dfm @@ -238,6 +238,46 @@ inherited frViewProcesoPresupuestosCliente: TfrViewProcesoPresupuestosCliente DataBinding.FieldName = 'FECHA_FACTURA' end end + object cxGridViewFacturasProforma: TcxGridDBTableView [6] + NavigatorButtons.ConfirmDelete = False + DataController.DataSource = dsFacturasProforma + DataController.DetailKeyFieldNames = 'ID_PEDIDO' + DataController.KeyFieldNames = 'ID' + DataController.MasterKeyFieldNames = 'ID' + DataController.Options = [dcoAnsiSort, dcoCaseInsensitive, dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoSortByDisplayText] + DataController.Summary.DefaultGroupSummaryItems = <> + DataController.Summary.FooterSummaryItems = <> + DataController.Summary.SummaryGroups = <> + OptionsBehavior.CellHints = True + OptionsCustomize.ColumnFiltering = False + OptionsData.Deleting = False + OptionsData.DeletingConfirmation = False + OptionsData.Editing = False + OptionsData.Inserting = False + OptionsSelection.CellSelect = False + OptionsSelection.UnselectFocusedRecordOnExit = False + OptionsView.CellEndEllipsis = True + OptionsView.NoDataToDisplayInfoText = '' + OptionsView.CellAutoHeight = True + OptionsView.ColumnAutoWidth = True + OptionsView.GridLineColor = cl3DLight + OptionsView.GridLines = glHorizontal + OptionsView.GroupByBox = False + OptionsView.GroupRowStyle = grsOffice11 + OptionsView.HeaderEndEllipsis = True + object cxGridViewFacturasProformaREFERENCIA: TcxGridDBColumn + Caption = 'Referencia' + DataBinding.FieldName = 'REFERENCIA' + end + object cxGridViewFacturasProformaSITUACION: TcxGridDBColumn + Caption = 'Situaci'#243'n' + DataBinding.FieldName = 'SITUACION' + end + object cxGridViewFacturasProformaFECHA_FACTURA: TcxGridDBColumn + Caption = 'Fecha' + DataBinding.FieldName = 'FECHA_FACTURA' + end + end inherited cxGridLevel: TcxGridLevel Options.DetailFrameColor = cl3DLight Options.DetailTabsPosition = dtpTop @@ -258,6 +298,10 @@ inherited frViewProcesoPresupuestosCliente: TfrViewProcesoPresupuestosCliente GridView = cxGridViewFacturasCliente end end + object cxGridLevel1: TcxGridLevel + Caption = 'Facturas Proforma' + GridView = cxGridViewFacturasProforma + end end end inherited frViewFiltroBase1: TfrViewFiltroBase @@ -322,4 +366,8 @@ inherited frViewProcesoPresupuestosCliente: TfrViewProcesoPresupuestosCliente Left = 8 Top = 240 end + object dsFacturasProforma: TDADataSource + Left = 8 + Top = 288 + end end diff --git a/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.pas b/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.pas index f759e98..50f9bfd 100644 --- a/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.pas +++ b/Source/Modulos/ProcesoPresupuestoCliente/Views/uViewProcesoPresupuestosCliente.pas @@ -13,7 +13,8 @@ uses uViewBase, uViewFiltroBase, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, uBizPedidosCliente, uBizPedidosProveedor, uBizAlbaranesProveedor, - uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente, Grids, DBGrids; + uBizFacturasProveedor, uBizAlbaranesCliente, uBizFacturasCliente, uBizFacturasProforma, + Grids, DBGrids; type IViewListadoProcesoPedidoCliente = interface(IViewGrid) @@ -38,6 +39,10 @@ type procedure SetAlbaranesCliente(const Value: IBizAlbaranCliente); property AlbaranesCliente: IBizAlbaranCliente read GetAlbaranesCliente write SetAlbaranesCliente; + function GetFacturasProforma: IBizFacturaProforma; + procedure SetFacturasProforma(const Value: IBizFacturaProforma); + property FacturasProforma: IBizFacturaProforma read GetFacturasProforma write SetFacturasProforma; + function GetFacturasCliente: IBizFacturaCliente; procedure SetFacturasCliente(const Value: IBizFacturaCliente); property FacturasCliente: IBizFacturaCliente read GetFacturasCliente write SetFacturasCliente; @@ -51,26 +56,21 @@ type dsPedidosProveedor: TDADataSource; cxGridViewPedidosProveedor: TcxGridDBTableView; cxGridViewPedidosProveedorREFERENCIA: TcxGridDBColumn; - cxGridLevelPedidosProveedor: TcxGridLevel; cxGridViewPedidosProveedorNOMBRE: TcxGridDBColumn; cxGridViewFECHA_PEDIDO: TcxGridDBColumn; cxGridViewPedidosProveedorFECHA_PEDIDO: TcxGridDBColumn; cxGridViewPedidosProveedorSITUACION: TcxGridDBColumn; dsAlbaranesProveedor: TDADataSource; - cxGridLevelAlbaranesProveedor: TcxGridLevel; cxGridViewAlbaranesProveedor: TcxGridDBTableView; cxGridViewAlbaranesProveedorREFERENCIA: TcxGridDBColumn; cxGridViewAlbaranesProveedorSITUACION: TcxGridDBColumn; cxGridViewAlbaranesProveedorFECHA_ALBARAN: TcxGridDBColumn; dsFacturasProveedor: TDADataSource; - cxGridLevelFacturasProveedor: TcxGridLevel; cxGridViewFacturasProveedor: TcxGridDBTableView; cxGridViewFacturasProveedorREFERENCIA: TcxGridDBColumn; cxGridViewFacturasProveedorREFERENCIA_PROVEEDOR: TcxGridDBColumn; cxGridViewFacturasProveedorSITUACION: TcxGridDBColumn; cxGridViewFacturasProveedorFECHA_FACTURA: TcxGridDBColumn; - cxGridAlbaranesCliente: TcxGridLevel; - cxGridFacturasCliente: TcxGridLevel; cxGridViewAlbaranesCliente: TcxGridDBTableView; cxGridViewFacturasCliente: TcxGridDBTableView; cxGridViewFacturasClienteREFERENCIA: TcxGridDBColumn; @@ -81,6 +81,13 @@ type cxGridViewAlbaranesClienteFECHA_ALBARAN: TcxGridDBColumn; cxGridViewFacturasClienteSITUACION: TcxGridDBColumn; cxGridViewFacturasClienteFECHA_FACTURA: TcxGridDBColumn; + cxGridFacturasCliente: TcxGridLevel; + dsFacturasProforma: TDADataSource; + cxGridViewFacturasProforma: TcxGridDBTableView; + cxGridViewFacturasProformaREFERENCIA: TcxGridDBColumn; + cxGridLevel1: TcxGridLevel; + cxGridViewFacturasProformaSITUACION: TcxGridDBColumn; + cxGridViewFacturasProformaFECHA_FACTURA: TcxGridDBColumn; procedure CustomViewShow(Sender: TObject); protected @@ -89,6 +96,7 @@ type FAlbaranesProveedor: IBizAlbaranProveedor; FFacturasProveedor: IBizFacturaProveedor; FAlbaranesCliente: IBizAlbaranCliente; + FFacturasProforma: IBizFacturaProforma; FFacturasCliente: IBizFacturaCliente; function GetPedidosCliente: IBizPedidoCliente; @@ -109,6 +117,9 @@ type function GetFacturasCliente: IBizFacturaCliente; procedure SetFacturasCliente(const Value: IBizFacturaCliente); + function GetFacturasProforma: IBizFacturaProforma; + procedure SetFacturasProforma(const Value: IBizFacturaProforma); + public property PedidosCliente: IBizPedidoCliente read GetPedidosCliente write SetPedidosCliente; property PedidosProveedor: IBizPedidoProveedor read GetPedidosProveedor write SetPedidosProveedor; @@ -116,6 +127,7 @@ type property FacturasProveedor: IBizFacturaProveedor read GetFacturasProveedor write SetFacturasProveedor; property AlbaranesCliente: IBizAlbaranCliente read GetAlbaranesCliente write SetAlbaranesCliente; property FacturasCliente: IBizFacturaCliente read GetFacturasCliente write SetFacturasCliente; + property FacturasProforma: IBizFacturaProforma read GetFacturasProforma write SetFacturasProforma; destructor Destroy; override; end; @@ -141,6 +153,7 @@ begin FAlbaranesProveedor:= Nil; FFacturasProveedor:= Nil; FAlbaranesCliente:= Nil; + FFacturasProforma:= Nil; FFacturasCliente:= Nil; inherited; end; @@ -160,6 +173,11 @@ begin Result := FFacturasCliente; end; +function TfrViewProcesoPresupuestosCliente.GetFacturasProforma: IBizFacturaProforma; +begin + Result := FFacturasProforma; +end; + function TfrViewProcesoPresupuestosCliente.GetFacturasProveedor: IBizFacturaProveedor; begin Result := FFacturasProveedor; @@ -202,6 +220,16 @@ begin dsFacturasCliente.DataTable := Nil; end; +procedure TfrViewProcesoPresupuestosCliente.SetFacturasProforma( + const Value: IBizFacturaProforma); +begin + FFacturasProforma := Value; + if Assigned(FFacturasProforma) then + dsFacturasProforma.DataTable := FFacturasProforma.DataTable + else + dsFacturasProforma.DataTable := Nil; +end; + procedure TfrViewProcesoPresupuestosCliente.SetFacturasProveedor(const Value: IBizFacturaProveedor); begin FFacturasProveedor := Value; diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dpk b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dpk new file mode 100644 index 0000000..046743c --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dpk @@ -0,0 +1,49 @@ +package FacProforma_FacCli_relation; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$IMPLICITBUILD OFF} + +requires + FacturasCliente_model, + FacturasCliente_controller, + rtl, + vcl, + cxLibraryD11, + dxThemeD11, + dxGDIPlusD11, + dxCoreD11, + vclx, + cxEditorsD11, + cxDataD11, + dbrtl, + vcljpg, + vcldb, + FacturasProforma_model, + FacturasProforma_controller; + +contains + uGenerarFacturasCliFacProformaUtils in 'uGenerarFacturasCliFacProformaUtils.pas' {dmGenerarFacturasCliFacProforma}, + uEditorFechaFacturaFinal in 'uEditorFechaFacturaFinal.pas' {fEditorFechaFacturaFinal: F}; + +end. diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dproj b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dproj new file mode 100644 index 0000000..3deccd1 --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.dproj @@ -0,0 +1,1026 @@ + + + + {69494a8c-0a35-41ea-b8ec-ea790bfc0662} + FacProforma_FacCli_relation.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\Output\Debug\Cliente\FacProforma_FacCli_relation.bpl + + + 7.0 + False + False + 0 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + RELEASE + + + 7.0 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borland Sample Components + Delphi 1.0 Compatibility Components + Borland MyBase DataAccess Components + TeeChart Components + Borland SimpleDataset Component (DBX) + ExpressBars extended items by Developer Express Inc. + ExpressBars by Developer Express Inc. + ExpressScheduler 2 by Developer Express Inc. + ExpressVerticalGrid by Developer Express Inc. + ExpressBars DBNavigator by Developer Express Inc. + ExpressBars extended DB items by Developer Express Inc. + ExpressSideBar by Developer Express Inc. + JVCL Band Objects + JVCL Non-Visual Components + JVCL Encryption and Compression Components + JVCL Dialog Components + JVCL Docking Components + JVCL DotNet Controls + JVCL EDI Components Designtime Package + JVCL HMI Controls design time unit + JVCL Interpreter Components + JVCL Jans Components + JVCL Managed Threads + JVCL Multimedia and Image Components + JVCL Network Components + JVCL Page Style Components + JVCL Plugin Components + JVCL Print Preview Components + JVCL Runtime Design Components + JVCL Time Framework + JVCL Unified Interbase Components + JVCL Validators and Error Provider Components + SMImport suite: data importing into dataset. Scalabium/Mike Shkolnik, 2000-2005 + SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004. + Intraweb 8.0 Design Package for Borland Development Studio 2006 + Internet Explorer Components + FacProforma_FacCli_relation.dpk + + + + + MainSource + + + + + + + + + + + + + + +
fEditorFechaFacturaFinal
+ F +
+ +
dmGenerarFacturasCliFacProforma
+
+ + + + +
+
+ diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.rc b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.rc new file mode 100644 index 0000000..153736a --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/FacProforma_FacCli_relation.rc @@ -0,0 +1,22 @@ +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +FILEFLAGSMASK 0x3FL +FILEFLAGS 0x00L +FILEOS 0x40004L +FILETYPE 0x1L +FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "0C0A04E4" + BEGIN + VALUE "FileVersion", "1.0.0.0\0" + VALUE "ProductVersion", "1.0.0.0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0C0A, 1252 + END +END diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.dfm b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.dfm new file mode 100644 index 0000000..a3796ab --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.dfm @@ -0,0 +1,60 @@ +object fEditorFechaFacturaFinal: TfEditorFechaFacturaFinal + Left = 0 + Top = 0 + BorderStyle = bsToolWindow + Caption = 'Fecha de la factura' + ClientHeight = 148 + ClientWidth = 371 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 16 + Top = 16 + Width = 320 + Height = 13 + Caption = + 'Introduzca la fecha que desea para la factura que se va a genera' + + 'r' + WordWrap = True + end + object Label2: TLabel + Left = 24 + Top = 59 + Width = 86 + Height = 13 + Caption = 'Fecha de factura:' + WordWrap = True + end + object eFechaFactura: TcxDateEdit + Left = 127 + Top = 56 + Style.LookAndFeel.Kind = lfStandard + Style.LookAndFeel.NativeStyle = True + StyleDisabled.LookAndFeel.Kind = lfStandard + StyleDisabled.LookAndFeel.NativeStyle = True + StyleFocused.LookAndFeel.Kind = lfStandard + StyleFocused.LookAndFeel.NativeStyle = True + StyleHot.LookAndFeel.Kind = lfStandard + StyleHot.LookAndFeel.NativeStyle = True + TabOrder = 0 + Width = 162 + end + object Button1: TButton + Left = 286 + Top = 110 + Width = 75 + Height = 25 + Caption = 'Continuar' + ModalResult = 1 + TabOrder = 1 + end +end diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.pas b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.pas new file mode 100644 index 0000000..17270e0 --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uEditorFechaFacturaFinal.pas @@ -0,0 +1,35 @@ +unit uEditorFechaFacturaFinal; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, + cxDropDownEdit, cxCalendar; + +type + TfEditorFechaFacturaFinal = class(TForm) + Label1: TLabel; + eFechaFactura: TcxDateEdit; + Button1: TButton; + Label2: TLabel; + procedure FormShow(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + fEditorFechaFacturaFinal: TfEditorFechaFacturaFinal; + +implementation + +{$R *.dfm} + +procedure TfEditorFechaFacturaFinal.FormShow(Sender: TObject); +begin + eFechaFactura.Date := Date; +end; + +end. diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.dfm b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.dfm new file mode 100644 index 0000000..8235128 --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.dfm @@ -0,0 +1,5 @@ +object dmGenerarAlbaranesCli: TdmGenerarAlbaranesCli + OldCreateOrder = False + Height = 176 + Width = 254 +end diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.pas b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.pas new file mode 100644 index 0000000..10f534d --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacProformaFacCliUtils.pas @@ -0,0 +1,95 @@ +unit uGenerarFacProformaFacCliUtils; + +interface + +uses + Windows, SysUtils, Classes, uBizFacturasCliente, pngimage, JSDialog; + +type + TdmGenerarAlbaranesCli = class(TDataModule) + end; + + function GenerarAlbaranCli(AFactura : IBizFacturaCliente) : Boolean; overload; + +implementation + +{$R *.dfm} + +uses + uDialogUtils, uDataTableUtils, + uBizAlbaranesCliente, + uAlbaranesClienteController, + uFacturasClienteController; + +var + dmGenerarAlbaranesCli: TdmGenerarAlbaranesCli; + AFacturasClienteController : IFacturasClienteController; + AAlbaranesClienteController : IAlbaranesClienteController; + +procedure Inicializar; +begin + dmGenerarAlbaranesCli := TdmGenerarAlbaranesCli.Create(nil); + AFacturasClienteController := TFacturasClienteController.Create; + AAlbaranesClienteController := TAlbaranesClienteController.Create; +end; + +procedure Finalizar; +begin + FreeAndNIL(dmGenerarAlbaranesCli); + AFacturasClienteController := nil; + AAlbaranesClienteController := nil; +end; + +function GenerarAlbaranCli(AFactura : IBizFacturaCliente) : Boolean; overload; +var + AAlbaranNuevo : IBizAlbaranCliente; +begin + Result := False; + + if not Assigned(AAlbaranesClienteController) then + Inicializar; + + if not Assigned(AFactura) then + raise Exception.Create('Factura de cliente no asignada (GenerarAlbaranCli)'); + + if not AFactura.DataTable.Active then + AFactura.DataTable.Active := True; + + try + AAlbaranNuevo := AAlbaranesClienteController.Nuevo; + + with AAlbaranNuevo do + begin + TIPO := CTE_TIPO_ALBARAN_DEV; + ID_CLIENTE := AFactura.ID_CLIENTE; + CALLE := AFactura.CALLE; + CODIGO_POSTAL := AFactura.CODIGO_POSTAL; + POBLACION := AFactura.POBLACION; + PROVINCIA := AFactura.PROVINCIA; + // AAlbaran.PERSONA_CONTACTO := AFactura.PERSONA_CONTACTO; + // AAlbaran.TELEFONO := AFactura.TELEFONO; + IMPORTE_NETO := AFactura.IMPORTE_NETO; + IMPORTE_PORTE := AFactura.IMPORTE_PORTE; + DESCUENTO := AFactura.DESCUENTO; + IMPORTE_DESCUENTO := AFactura.IMPORTE_DESCUENTO; + BASE_IMPONIBLE := AFactura.BASE_IMPONIBLE; + IVA := AFactura.IVA; + IMPORTE_IVA := AFactura.IMPORTE_IVA; + IMPORTE_TOTAL := AFactura.IMPORTE_TOTAL; + // AAlbaran.DataTable.FieldByName(fld_AlbaranesProveedorOBSERVACIONES).AsVariant := AFactura.DataTable.FieldByName(fld_PedidosProveedorOBSERVACIONES).AsVariant; + ID_FORMA_PAGO := AFactura.ID_FORMA_PAGO; + ID_FACTURA := AFactura.ID; + end; + + DuplicarRegistros(AFactura.Detalles.DataTable, AAlbaranNuevo.Detalles.DataTable, mdrTodos); + + //Sustituir por if de guardar + if AAlbaranesClienteController.Guardar(AAlbaranNuevo) then + ShowInfoMessage('La orden de devolución se ha dado de alta con el código ' + AAlbaranNuevo.REFERENCIA); + + finally + AAlbaranNuevo := Nil; + end; +end; + +end. diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.dfm b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.dfm new file mode 100644 index 0000000..0eb5dc6 --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.dfm @@ -0,0 +1,311 @@ +object dmGenerarFacturasCliFacProforma: TdmGenerarFacturasCliFacProforma + OldCreateOrder = False + Height = 176 + Width = 254 + object JsListaFacturasGeneradas: TJSDialog + Glyph.Data = { + 0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00 + 00001C0806000000720DDF940000000970485973000017120000171201679FD2 + 520000000467414D410000B18E7CFB5193000003104944415478DAAD96FB4B14 + 5114C7CFE463DC1E606444BFF54424D3DC55CA52B1CCD7165A219905054182FD + 1452FD5810FD100406610A669A998FC4F5BDB6266265DAB60F5DD15E58FE03B2 + 3F99D29ABBA7B9779C71C61D9D6177CFCE70CFDCB97B3EF7DCF3BD33C38082FD + B502B2B300CC656020048688A24F036233A0671F40D43160BA87BF62AEEE1010 + 60D7AE293AD8B835815E9B625C80DC8F1E88D4A7C1E8C1FB8F9FD6C3C44035B3 + 21500A65F6D700FE2EA580A5EC551F4A50359316B31D76EFDC0EE5F72A645045 + A067AE0623074B8140891108F1057064CC0D556053DF173812B707E6DCF332A8 + 225080D201DB4AF99BF335B4D502F371415BCC364833C4C29F458F0C2A031281 + 081734AB0B3C88403C1E6E3E2E7960F6A8FFD27A7D3EF07A11DA2C76C84A8D87 + A57FCB32E8B8A54A4C8C21B59365C9015996EF2240B6634DF435B51460A46D1F + 70C093AA46BF09C980C12CA914E6F371ADD707EF1DB3B0B0B8006EB79B8EA96B + EA5106121851245129118FD8BFA2DC5C53C6BAF5EBBBBA97C2D64EC064195B1F + 286C76E956A0EA5C51AEB4764A9929F5750D5A9581D2274B9B651C0BA2F514A8 + 6F28E36B70AD9A4253EF97A9AA55B0CEBA87D03B645B3F43C1DE589C58186D10 + 81150FCAC57B11E161B04517099BB953C78643141B01BA28EEE4DAB0B04DE2B8 + CA460B9C399902E661BB3AB0F5AD038BF30CD4D7E7DD14815A61023027DD00EF + 469C1A80FD1C307F1578FD4A81E665945AD68924181A9D5007B6F4DBF1527E32 + F5C9D3632351F8F549AEE916B14EAA039BCD362C31A6040D23E7887D4A03B0CF + 86C5C6641A24BB7646D3F2D51A77F8C1BCDCFFC79CD3EAC0D7BD56AE86294165 + 4660CB5C6B737DD3062CCA31D00069E76E05241862CF1EDD05E7D40F756063CF + 673C7F5A4F679A59541EF03E4C8C3B0893DF67D481AFBAC7B0F05412CD30EBE2 + ED80F7617CEC0198FEF94B1BF06C6622AD4B4EC99D80F7A1666043D7281A3312 + FD84C20B8417C3AA789405239826E0CBCE4F98979E10344C33B0BE630473D312 + 82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA + 1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082} + Instruction.Text = 'Se han generado las facturas...' + Instruction.Glyph.Data = { + 0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00 + 00001C0806000000720DDF940000000970485973000017120000171201679FD2 + 520000000467414D410000B18E7CFB5193000003104944415478DAAD96FB4B14 + 5114C7CFE463DC1E606444BFF54424D3DC55CA52B1CCD7165A219905054182FD + 1452FD5810FD100406610A669A998FC4F5BDB6266265DAB60F5DD15E58FE03B2 + 3F99D29ABBA7B9779C71C61D9D6177CFCE70CFDCB97B3EF7DCF3BD33C38082FD + B502B2B300CC656020048688A24F036233A0671F40D43160BA87BF62AEEE1010 + 60D7AE293AD8B835815E9B625C80DC8F1E88D4A7C1E8C1FB8F9FD6C3C44035B3 + 21500A65F6D700FE2EA580A5EC551F4A50359316B31D76EFDC0EE5F72A645045 + A067AE0623074B8140891108F1057064CC0D556053DF173812B707E6DCF332A8 + 225080D201DB4AF99BF335B4D502F371415BCC364833C4C29F458F0C2A031281 + 081734AB0B3C88403C1E6E3E2E7960F6A8FFD27A7D3EF07A11DA2C76C84A8D87 + A57FCB32E8B8A54A4C8C21B59365C9015996EF2240B6634DF435B51460A46D1F + 70C093AA46BF09C980C12CA914E6F371ADD707EF1DB3B0B0B8006EB79B8EA96B + EA5106121851245129118FD8BFA2DC5C53C6BAF5EBBBBA97C2D64EC064195B1F + 286C76E956A0EA5C51AEB4764A9929F5750D5A9581D2274B9B651C0BA2F514A8 + 6F28E36B70AD9A4253EF97A9AA55B0CEBA87D03B645B3F43C1DE589C58186D10 + 81150FCAC57B11E161B04517099BB953C78643141B01BA28EEE4DAB0B04DE2B8 + CA460B9C399902E661BB3AB0F5AD038BF30CD4D7E7DD14815A61023027DD00EF + 469C1A80FD1C307F1578FD4A81E665945AD68924181A9D5007B6F4DBF1527E32 + F5C9D3632351F8F549AEE916B14EAA039BCD362C31A6040D23E7887D4A03B0CF + 86C5C6641A24BB7646D3F2D51A77F8C1BCDCFFC79CD3EAC0D7BD56AE86294165 + 4660CB5C6B737DD3062CCA31D00069E76E05241862CF1EDD05E7D40F756063CF + 673C7F5A4F679A59541EF03E4C8C3B0893DF67D481AFBAC7B0F05412CD30EBE2 + ED80F7617CEC0198FEF94B1BF06C6622AD4B4EC99D80F7A1666043D7281A3312 + FD84C20B8417C3AA789405239826E0CBCE4F98979E10344C33B0BE630473D312 + 82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA + 1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082} + Instruction.Icon = tdiCustom + CustomButtons = < + item + Caption = 'Continuar' + Value = 200 + Cancel = True + end> + ButtonBar.Buttons = [] + ButtonBar.Cancel = cbOK + ButtonBar.UseCancel = False + MainIcon = tdiCustom + Title = 'FactuGES' + Position = dpMainFormCenter + Icon.Data = { + 0000010003002020100001000400E8020000360000002020000001000800A808 + 00001E0300002020000001002000A8100000C60B000028000000200000004000 + 0000010004000000000000020000000000000000000000000000000000000000 + 000000008000008000000080800080000000800080008080000080808000C0C0 + C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000 + 0000000000000000000000000000000008777777777777777777777700000000 + 0877767777677776777767760000000008F88888888888888888888700000000 + 08F8FF8F8F888888888888860000000008FF8F8F88F8F8888888888C00000000 + 08F88888F8888888888888860000000008F8688878E8888E88E8788700000000 + 08F8688888F8F8FFFFFF88760000000008FF4888888F8FFFFFFF788700000000 + 08F8676767677677677658E50000000008FF8888888887878787888700000000 + 08FF8887887E8888888888860000000008FFE8E8E788C8E8FF8F8F8600000000 + 08FFF8F8F8F8FF8F88F8F8870000000008FFFFFF8FF8F8F8F88F888600000000 + 0FF8477878787878788788860000000008FF68888888F8FF8F8F788700000000 + 08B7588888FF8FFFFFFF78860000083008BB47887776777777776F86000000B7 + 8B9B73BB88788787E87878870000008BB8B9BB78888888EFF8F8FF8600000087 + B8BB8B888E8E8E88FFF8F886000000088BBB888FFFFFFFFFF8F877770000B9BB + B8FFBB9B9BFFFFFFF87466460000BBB9BB8FBBBBB8FFFFFFF88F888700000008 + B8BB88888FFFFFFFF88F8F7700000008BBBBBB8FFFFFFFFFFF8887700000007B + B7B98BB8FFFFFFFFF8887700000000B78B9B87B888F88F88F8877000000007B0 + 08BB883B78888788787700000000000000B9000000000000000000000000FFFF + FFFFF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000F9800000FC000000FC000000FC000000FE000000F0000 + 000F0000000FE000000FE000001FC000003FC000007F980000FFFCFFFFFF2800 + 0000200000004000000001000800000000000004000000000000000000000001 + 00000001000000000000694731007C5D49007E604C0081635000826451008567 + 540085685500886B5900896D5B008A6E5D008B705F008E715F008B7260008C72 + 61008E74640084766C00957A6900977D6D00887B72009A8171009D8272009C84 + 76009D8778009F897B00A28A7900A08B7D00A18C7E00E1B06E00E1B67D003E7A + 970073A0A5007AA2B70074AFBD007BB2BB003CAACE0028A5DB0020ADDF000D9A + E500209EE3000DA6E2001AA4EF0000A6FF000CABFE0009ACFE0010A4F10015AC + FA0000B5FB0000B0FD000CB6FC0000BFF90000BAFD0004BAFD0009BBFB0013B6 + F40015BFFA001CBDFB0026B7FD00589EC50040A4CD0040ABCC0050A2C7005DAE + C00060A3C20062A4C60060B7CB006AB0CD007BB6C80077BAC80061BADD0044AD + E50000C3F80007C6FB0000CAF80000CFFB0000D4F90026C8FA0026CDF8002BCC + F90039C4FB0039C2FC0039CAFA003FCFFB0024D6F80030D2F80039D5F80000F8 + F8001FF8F8002CF6F8003EF4F8005AC6DC0070CDDF0052C0E40054C9E3004DCE + FA005FC7FF004FD2FB004DD9F8005FD9FB006ED3E70063CDFE0060D1FB0060D8 + F90060DDF80046F8F90056F0F8005FFAFA0073E3F80073E4F90073EEF80060F1 + F800958A84009A918C0081999500A68F8200AD968500A3968C00AE988900AD9A + 8D00B19A8B00AF9C9000B09E9200B59F9200B7A29300B2A19600B5A19400B7A4 + 9700BDA79700B4A39800B1A59D00B4A79F00BAA69800BCA79900B4A89F00BCA8 + 9900BAA89C00BDAA9D00BEAC9E0083ADBD00B5A9A100BDABA000BEADA100BFAF + A500A0BABE00C0AB9E00C1AC9E00C6AE9F00E2B98100E4BA8300E4BB8400E5BC + 8500E1BD8E00E3BF9000C0ADA000C2B0A300C2B1A500C4B2A600C1B2A800C3B5 + AB00C8B4A800CCB9AD00CEBCB100D0BEB200D1BFB400E4C19300E5C29400E6C4 + 9600E8C69900D0C9A300CFC1B800D2C1B600D3C3B800D5C4B900D6C6BC00D8C6 + BC00D6C8BE00DAC9BF00ECD3B000EDD4B200EFD6B500E7D1B800E7D3BD00F0D8 + B6008CB7C40080BEC70097C3C70099C3C900ABD7CF00AFD9DD0086E3F90086E7 + F90086ECF8009EE5FB0090E8F900ACEDFC00BCEAFD00BCF1FB00BFF1FD00D7C9 + C000D9CAC100DCCBC200DACCC200DDCCC300DACCC400DDCEC400DED0C600DED1 + C900DED3CC00DFD4CD00E1D1C900E2D5CD00F0DCC200E3D8D200E5D9D200E2DA + D500E6DBD400E5DCD500E8DDD600E6DDD800E9DFD900E6E0DB00EAE0DA00EAE2 + DD00ECE3DE00EBE4DE00ECE4DE00F3E7D900C6E1EF00C9EFFD00D7F6FD00DFF3 + FF00DFFEFE00EBE7E300EDE6E100EFE7E400EEE8E400F0EAE600F2EDE900F2EE + EC00F4EFEC00F5F0EE00F9F4ED00E7FAFD00EBF8FF00F6F2F000F7F4F100F8F4 + F200F9F7F500FAF8F600FBF9F900FCFBFA00FCFCFB00FEFEFE00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000007D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D + 0D0D0000000000000000009C9C19191919191919191919191919191919191919 + 1903000000000000000000ABDECBCBC7C7AFABABABABAAA3A2A2A0A0A0A0A0A0 + 8607000000000000000000ABECEAE9DEDEDEDED7D5D2D2D2CBCBCBCBB0CBB0CB + 9007000000000000000000ABEDECEAE9DEDEDBD7D7D5D2D2D2CDCDCBB0B0B0B0 + 9007000000000000000000AFEDE9A9CFD2CFD2CDCBCBCBB0B0ABACA3A3A3A3B0 + 9007000000000000000000AFF0D5017783838386868686869099909999907BB0 + 9007000000000000000000B0F4D501A0B0CBD2D5DEECEDF7FAFAFAFAFAF77BAA + 9007000000000000000000CBF4DC01A0B0B0B0D2D5DBEAEDF7FAFAFAFAF47BB0 + 9007000000000000000000CBF8DC010404070604090909090D0D110D110D02A3 + 9007000000000000000000CBFAED9E9E9E9C999E8C8C8C868683837E7D7D7ACB + 9007000000000000000000CBFAF1A7A7A6A6A6A69898989898B5DBDBD5D5D2D2 + 9907000000000000000000CDFAF796969696961D961D931D1DB4DEDBD7D5D5D2 + 9C07000000000000000000CFFAFAFAFAF8F7F0F0EDEDEDECE9E9DEDEDED7D5D5 + 9907000000000000000000CDFAFAEAF0EDEDECEAEAE9DEDEDBDCD5D5D5D5D2D5 + 9C07000000000000000000D2FAEC01737D7D7B7D7D7B7D7B7D7B7B7B7D7B7DD2 + 9907000000000000000000CFFAEC019EABB0CBD2D5DCDEECEDF4F4F4F4EA7BD2 + 9C07000000000000000000B9524601A0B0B0CBB5D5DEEAEDF7FAFAFAFAF47DD5 + 9C070000000000213F0000B83226010C3F5C1F111214141616191B1B1B1807D2 + 9C07000000000000253D8A5B322D711E2860BA7E7E7A7E797A797979767676D5 + 9E0700000000000041375E662F2B65314EBBB6B6B6B6B4B4B1E2F4EDEDEDECEA + 9C070000000000008F5D66663232394EC1A81C1C1C1C1C1C1CD3F7F4EDDED7D5 + 9C0700000000000000B7BE6E5758BEBDE4E6E6F3FAFAFAFAFAFAF7F4D5928675 + 7304000000002A2A2A2A4A6AFAE7562F2A2A2A5FFAFAFAFAFAFAF8D577010101 + 0101000000004747472F4A59C5E7564A32474766FAFAFAFAFAFAFADCA0D2CFB0 + A20C00000000000000436C6958686D6BC2C5C5E7FAFAFAFAFAFAFADEAADEDBCB + 1470000000000000004551534A4A5250C0E7FAFAFAFAFAFAFAFAFADEAAD7B514 + 700000000000000042384C54472B613550C3FAFAFAFAFAFAFAFAFADEA1B0196F + 000000000000000024234463322EBC5A3664E3ECE9E9E9E9E9E9E9CF90731300 + 000000000000003A3C00002232298B8B3E3B207E8B7E8B7E827E817E74100000 + 0000000000000000000000003227000000000000000000000000000000000000 + 000000000000FFFFFFFFF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000F9800000FC000000FC000000FC000 + 000FE000000F0000000F0000000FE000000FE000001FC000003FC000007F9800 + 00FFFCFFFFFF2800000020000000400000000100200000000000801000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000007067 + 5F70AA9382E570513CE3735540E3735540E3735540E3735540E3735540E37355 + 40E3735540E3735540E3735540E3735540E3735540E3735540E3735540E37355 + 40E3735540E3735540E3735540E3735540E3735540E3735540E372533EE5BAAB + A070000000000000000000000000000000000000000000000000000000005E54 + 4C7FCAB7ABFFC5B5AAFFA18877FFA28A78FFA28A79FFA28A79FFA28A79FFA28A + 79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A + 79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA58D7CFF7A5B46FFB2A1 + 967F000000000000000000000000000000000000000000000000000000006055 + 4D7ED7C6BBFFEDE4E0FFD9CCC4FFD9CCC4FFD9CBC3FFD8CAC1FFD7C9BFFFD6C7 + BDFFD5C6BBFFD4C4BAFFD3C3B8FFD2C1B7FFD1C0B5FFD0BEB3FFCFBDB2FFCEBC + B0FFCEBBAFFFCEBBAFFFCEBBAFFFCEBBAFFFCEBCB0FFBEAA9CFF82644FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006056 + 4D7ED7C8BCFFF2EBE8FFEFE9E5FFEEE7E2FFECE5E0FFEBE2DEFFEAE0DBFFE9DE + D8FFE7DBD4FFE5D9D1FFE3D7CFFFE2D4CCFFE1D2C9FFDFD0C7FFDDCDC4FFDCCB + C2FFDBC9BFFFDBC9BFFFDBC9BFFFDBC9BFFFDCCAC1FFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006155 + 4E7ED8C9BDFFF3EDE9FFF1EAE6FFF0E9E6FFEEE6E1FFECE4DFFFEBE2DDFFEAE0 + DAFFE9DED7FFE7DBD4FFE5D9D1FFE3D7CFFFE2D4CCFFE1D2C9FFDFD0C7FFDDCD + C4FFDCCBC2FFDBC9BFFFDBC9BFFFDBC9BFFFDCCAC0FFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006157 + 4E7ED9C9BFFFF4EFEDFFEFE8E3FFD0C2B9FFDFD5CEFFE0D5CEFFE0D4CCFFDED3 + CBFFDDD1C8FFDCCFC6FFDACCC4FFD9CBC1FFD8C9BFFFD7C7BDFFD6C5BBFFD5C4 + B9FFD3C2B7FFD2C0B5FFD2BFB4FFD2BFB4FFDAC8BEFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDACCC0FFF5F2EFFFE5DDD9FF5C3821FFB0998AFFB8A394FFB8A394FFB9A3 + 94FFB8A495FFB9A597FFB9A698FFBAA698FFBBA799FFBBA89AFFBBA89BFFBCA8 + 9BFFBCA89BFFBCA89BFFBBA89AFFB49E8FFFD8C6BBFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDBCBC1FFF8F4F3FFE7E0DBFF5F3C24FFD0BDB2FFDCCBC1FFDDCCC3FFE2D2 + CBFFE7DBD4FFEDE2DEFFF0E8E6FFF5F0EDFFF9F7F4FFFDFDFDFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFAF8F7FFB39D8DFFD8C6BBFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDCCEC3FFFAF6F5FFE9E2DDFF5F3C24FFD2BFB5FFDFCDC4FFDECCC3FFE0CE + C6FFE4D4CDFFE9DDD6FFEFE4E0FFF1EAE8FFF7F1EFFFFBF8F6FFFFFEFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFCFBFAFFB5A090FFD9C7BEFFC1AD9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006257 + 4F7EDDCFC4FFFCF9F9FFE9E4E0FF5F3A23FF7C5D49FF7F5F4CFF7E5F4CFF7E60 + 4DFF7F614DFF816350FF826552FF836654FF846856FF856A57FF866B59FF876C + 5BFF876D5BFF876D5BFF866B59FF72523DFFD5C3B9FFC1AFA1FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006357 + 507EDECFC6FFFCFCFBFFF4F1F0FFC3B6AEFFC3B5ADFFC1B4ACFFC0B3AAFFBFB1 + A9FFBEB0A6FFBDAEA5FFBDACA3FFBCABA2FFBBAAA0FFBAA99FFFB8A69AFFB8A4 + 98FFB6A396FFB5A194FFB49F93FFB39D90FFDCCDC4FFC2AEA1FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006357 + 507EDFD2C7FFFEFEFDFFF9F5EFFFE8C696FFE9C799FFE8C697FFE7C596FFE7C4 + 95FFE6C394FFE5C293FFE4C091FFE4C090FFE3BF8FFFE2BD8CFFE9D5BFFFEBE1 + DCFFEADFD8FFE7DCD5FFE5DAD3FFE4D8D0FFE3D4CCFFC2AFA2FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006458 + 517EE0D3C8FFFFFFFFFFFAF5EFFFE3B77CFFE4B97FFFE2B87EFFE3B77DFFE2B7 + 7CFFE2B67BFFE1B57AFFE1B479FFE0B478FFE0B377FFDFB174FFE6D0B7FFEBE1 + DCFFE8DFD9FFE8DDD6FFE6D9D2FFE3D8D1FFE4D7CFFFC3AFA2FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006458 + 517EE1D2C9FFFFFFFFFFFEFEFDFFFEFFFFFFFCFDFEFFFBFBFBFFF9F7F8FFF8F5 + F6FFF7F3F2FFF5F1F0FFF4EFEEFFF1EDEBFFF0EBE9FFEEE9E6FFEDE6E2FFECE3 + DEFFEBE1DBFFE9DFD9FFE8DDD6FFE6DAD3FFE5D9D2FFC3B0A3FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006459 + 517EE1D4CAFFFFFFFFFFFDFDFCFFEEEBE8FFF5F2F0FFF4F0EFFFF3EFECFFF2ED + EAFFF1EBE8FFEEE9E5FFEFE7E3FFECE5E1FFEAE4DEFFEAE1DCFFE8E0DAFFE7DE + D8FFE6DDD6FFE5DBD4FFE4D8D1FFE2D6CEFFE6DBD4FFC3B1A4FF81634EFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006559 + 527EE2D4CAFFFFFFFFFFF0ECEAFF5B361EFFAB9383FFB39D8EFFB39D8DFFB39D + 8DFFB29D8DFFB29C8DFFB29C8CFFB29C8CFFB29C8CFFB29C8CFFB29C8CFFB29C + 8CFFB29C8CFFB29C8CFFB29C8DFFB39D8EFFE3D8D0FFC4B1A4FF81634EFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006559 + 527EE5D4CAFFFFFFFFFFF7F0EBFF5F3B24FFCCB8ADFFD7C5BAFFD9C7BDFFDCCC + C3FFE1D4CCFFE5DAD4FFE8E0DBFFEDE5E1FFF1EBE9FFF5F2EFFFF7F5F3FFF8F6 + F4FFF8F5F4FFF8F6F4FFF1EEEAFFB29C8DFFE6DAD3FFC4B2A5FF81634EFFB2A1 + 967E00000000000000000000000000000000000000000000000000000000685A + 527E9AC6C9FF35CFFEFF3DAEEBFF663E24FFD2BFB4FFE0CBBFFFE0C9BDFFE1CD + C4FFE4D5CDFFE9DED7FFEEE5E0FFF2EBE8FFF6F2F0FFFCF8F8FFFFFFFEFFFFFF + FFFFFFFFFFFFFFFFFFFFFCFAF9FFB49E8FFFE7DED7FFC5B3A6FF81634EFFB2A1 + 967E00000000000000000000000000000000007792910072A7A3001E33366957 + 4C7C86C1C8FF00BFFBFF079AEBFF6A3E23FF926D57FF5FA3C8FF4AC1E8FF6C9C + A2FF917260FF927767FF947A69FF957C6CFF977E6FFF998171FF9A8374FF9B85 + 76FF9C8678FF9C8678FF998274FF7D5E49FFE3D9D4FFC5B3A7FF81634EFFB2A1 + 967E00000000000000000000000000000000005A6F7000A9E5E40075AEAE5C90 + A5BD75D0E0FF00BFFAFF0CA3F4FF8A9A91FF3C7492FF03A4E4FF4AD5FFFF98C4 + CBFFB3A196FFB1A197FFB0A096FFB09F95FFAF9D92FFAF9C91FFAD9A8EFFAC99 + 8CFFAB988AFFAB9789FFAA9688FFA99386FFE8E0DAFFC5B4A7FF81634EFFB2A1 + 967E00000000000000000000000000000000000000002DA5BFC110C2FFFF4DD0 + FDFF64DBF9FF00B3FAFF09A8FEFF68D7FFFF04B5FFFF24CCFBFFAFD8CEFFF7DA + B8FFF3DBBBFFF3DBBAFFF2D9B9FFF1D8B7FFF0D7B4FFEED5B2FFF6EADDFFF9F6 + F4FFF7F3F1FFF5F1EEFFF5EFECFFF4EDEAFFF1EBE7FFC6B4A8FF81634EFFB2A1 + 967E00000000000000000000000000000000000000005F8A909142C7E4E960DE + F8FF64D7FAFF00B6FDFF00B8FDFF21B2FDFF1ECCF7FF93EBFCFFD2C69BFFE1AB + 63FFDFAC66FFDFAC66FFDFAC66FFDFAC66FFDFAC66FFDEA961FFEFDBC0FFF8F6 + F5FFF6F2F0FFF3EDEBFFECE2DCFFE9DFD9FFE5DBD6FFC2B1A4FF81634FFFB2A1 + 967E000000000000000000000000000E171A000E171A00040B145994A4A990EB + FCFF61F1F7FF13FAF7FF23F9F7FF93EDF7FF8CE5F8FFD5F2FDFFE9F8FFFFE7F8 + FFFFF0FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFDFEFFFFFAFAF9FFF9F7 + F5FFF7F2F0FFE8DFD8FFC7AE9FFFBEA998FFAF9888FFB09A8AFF7F604DFFB2A1 + 967E00000000000000000000000000AAFFFF00AAFFFF00AAFFFF00A4FFFF00CD + FAFF5DFCF9FFFFFFFFFFEEFEFEFF00FBF7FF00AAFEFF00A1FFFF00A1FFFF00A0 + FFFF56C3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFBFFFCFBFAFFFBFA + F8FFE6DDD6FFAA9180FF5D3922FF603D26FF613E27FF613E28FF634029FFB4A3 + 987E00000000000000000000000000CAFFFF00CAFFFF00CBFFFF00B0FFFF00CD + FBFF38F5F7FFC3EFFAFFF0FFFEFF00FAF7FF00C8F7FF00C2F7FF00C2F7FF00C1 + F7FF57D7FAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFDFDFCFFFCFC + FBFFE7DED8FFCCB9ACFFE6DBD5FFE2D7D0FFDCCFC5FFD7C5BBFF8E705DFFB4A2 + 9680000000000000000000000000002E383C002E383C00252F364C99B0B57DE8 + FBFF59F1F7FF25F7F7FF41FAF8FF7CEEF7FF77E4F7FFB5EFFCFFC6F2FDFFC3F2 + FDFFD9F6FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFEFFFEFE + FEFFE9E1DAFFCEBCAFFFF1E9E3FFEADFD8FFE4D5CCFF9D816FFF3A291F868985 + 831C00000000000000000000000000000000000000004E7073774AB0DADC37C9 + FBFF22D5F7FF00D3F9FF02C3FBFF37D5F7FF34BEFCFFA2E6FAFFECFBFDFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFF + FFFFEAE2DCFFCDBBADFFEADFD8FFE3D5CBFF9F8271FF3E2D2386050100200000 + 000000000000000000000000000000000000000000003E9CC4C219C0FFFF23C9 + FCFF30D3F8FF00BEF8FF06A8FEFF4FDCF8FF00B8FCFF32C2FBFFC0EBFCFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFEAE3DEFFCDB9ABFFDDCEC4FFA58979FF3E2C1F8F0905041B000000000000 + 000000000000000000000000000000000000003451510099DDDB0091C0C35DAD + BCCF76D7E9FF00BEF9FF10A9FBFFBDDEDEFF5AC8DDFF0AB5F7FF62CEFFFFCBE4 + F1FFF1E7E0FFEFE7E1FFEEE6E1FFEEE6E1FFEEE6E0FFEDE6E0FFEDE5E0FFEEE6 + E1FFE1D4CCFFC5AE9FFFA68D7FF53E2718A10402000E00000000000000000000 + 0000000000000000000000000000000000000075B7AF0099C7C500323E425442 + 3B5C6BA8B1DA00C1FCFF0EA1F3F8A98E80C0AB9081C12698B1C10088C4C14C85 + A3C1A18D80C19E8D81C19E8B81C19D8C80C19B8C7FC19B8A7FC19C897FC19A89 + 7EC19B8B7EC1897769C2432B1BAC000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000045565A00C5FFFF0094E6E2000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFFFFF0000007F0000007F0000007F000 + 0007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F000 + 0007F0000007F0000007F0000007F0000007F0000007F0000007800000078000 + 0007C0000007C000000700000007000000070000000700000007C000000FC000 + 001F8000003F800000FFF8FFFFFF} + Width = 450 + Left = 72 + Top = 16 + end +end diff --git a/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.pas b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.pas new file mode 100644 index 0000000..6259426 --- /dev/null +++ b/Source/Modulos/Relaciones/Facturas proforma - Facturas de cliente/uGenerarFacturasCliFacProformaUtils.pas @@ -0,0 +1,317 @@ +unit uGenerarFacturasCliFacProformaUtils; + +interface + +uses + Windows, SysUtils, Classes, uBizFacturasProforma, uBizFacturasCliente, pngimage, JSDialog; + +type + TdmGenerarFacturasCliFacProforma = class(TDataModule) + JsListaFacturasGeneradas: TJSDialog; + end; + + function GenerarFacturaCliFacProforma(const IDFacturaProforma : Integer; const CopiarDetalles: Boolean = True) : Boolean; overload; + function GenerarFacturaCliFacProforma(AFacturaProforma : IBizFacturaProforma; FechaFacturaNueva:TDateTime; const CopiarDetalles: Boolean = True) : Boolean; overload; + function GenerarFacturaCliFacProforma : Boolean; overload; + + //Siempre se hará una relación 1 a 1 entre facturas proforma y facturas + function GenerarFacturas(AFacturas : IBizFacturaCliente; AFacturaProforma : IBizFacturaProforma; FechaFacturaNueva:TDateTime; const CopiarDetalles: Boolean = True): Boolean; + +implementation + +{$R *.dfm} + +uses + DB, uDialogUtils, uDADataTable, uControllerDetallesBase, uEditorFechaFacturaFinal, + uBizDetallesFacturaCliente, uBizDetallesFacturaProforma, + uFacturasProformaController, uDetallesFacturaClienteController, + uFacturasClienteController, schFacturasClienteClient_Intf, schFacturasProformaClient_Intf; + + +var + dmGenerarFacturasCliFacProforma: TdmGenerarFacturasCliFacProforma; + AFacturasClienteController : IFacturasClienteController; + AFacturasProformaController : IFacturasProformaController; + ADetallesAlbaranesClienteController : IDetallesFacturaClienteController; + +procedure CopiarArticulosFacturaProforma(AOrigen: IBizDetallesFacturaProforma; + ADestino : IBizDetallesFacturaCliente); +var + i : integer; + ADetallesController : IDetallesFacturaClienteController; +begin + if not Assigned(AOrigen) then + raise Exception.Create ('Origen no asignado (CopiarArticulosFacturaProforma)'); + + if not Assigned(ADestino) then + raise Exception.Create ('Destino no asignado (CopiarArticulosFacturaProforma)'); + + if not AOrigen.DataTable.Active then + AOrigen.DataTable.Active := True; + + if not ADestino.DataTable.Active then + ADestino.DataTable.Active := True; + + ADetallesController := TDetallesFacturaClienteController.Create; + try + //OJO IMPORTANTE + //Siempre que vayamos a trabajar con los detalles debemos hacer un beginupdate de los mismos y un endupdate para + //obligarle siempre a recalcular los detalles una sola vez + ADetallesController.BeginUpdate(ADestino); + + AOrigen.DataTable.First; + for i := 0 to AOrigen.DataTable.RecordCount - 1 do + begin + ADetallesController.Add(ADestino, TIPO_DETALLE_CONCEPTO); + ADestino.Edit; +// ADestino.REFERENCIA := AOrigen.REFERENCIA; + if AOrigen.ID_ARTICULO > 0 then + ADestino.ID_ARTICULO := AOrigen.ID_ARTICULO; + ADestino.CONCEPTO := AOrigen.CONCEPTO; + ADestino.CANTIDAD := AOrigen.CANTIDAD; + ADestino.IMPORTE_UNIDAD := AOrigen.IMPORTE_UNIDAD; + ADestino.IMPORTE_TOTAL := AOrigen.IMPORTE_TOTAL; + ADestino.DESCUENTO := AOrigen.DESCUENTO; + ADestino.IMPORTE_PORTE := AOrigen.IMPORTE_PORTE; + ADestino.VISIBLE := AOrigen.VISIBLE; +// ADestino.REFERENCIA_PROVEEDOR := AOrigen.REFERENCIA_PROVEEDOR; + ADestino.Post; + AOrigen.Next; + end; + finally + ADetallesController.EndUpdate(ADestino); + ADetallesController := NIL; + end; +end; + +procedure Inicializar; +begin + dmGenerarFacturasCliFacProforma := TdmGenerarFacturasCliFacProforma.Create(nil); + AFacturasClienteController := TFacturasClienteController.Create; + AFacturasProformaController := TFacturasProformaController.Create; +// ADetallesAlbaranesClienteController := TDetallesFacturaClienteController.Create; +end; + +procedure Finalizar; +begin + FreeAndNIL(dmGenerarFacturasCliFacProforma); + AFacturasClienteController := nil; + AFacturasProformaController := nil; +// ADetallesAlbaranesClienteController := nil; +end; + +function GenerarFacturaCliFacProforma(const IDFacturaProforma : Integer; const CopiarDetalles: Boolean = True) : Boolean; overload; +var + AFacturaProforma : IBizFacturaProforma; + AFechaFactura: TDateTime; +begin + Result := False; + try + if not Assigned(AFacturasProformaController) then + Inicializar; + + AFacturaProforma := AFacturasProformaController.Buscar(IDFacturaProforma); + if Assigned(AFacturaProforma) then + begin + //Preguntamos la fecha que deseamos tengan la factura a generar + with TfEditorFechaFacturaFinal.Create(Nil) do + begin + ShowModal; + AFechaFactura := eFechaFactura.Date; + Free; + end; + Result := GenerarFacturaCliFacProforma(AFacturaProforma, AFechaFactura); + end; + + if Assigned(AFacturasProformaController) then + Finalizar; + + finally + AFacturaProforma := NIL; + end; +end; + +function GenerarFacturaCliFacProforma(AFacturaProforma : IBizFacturaProforma; FechaFacturaNueva:TDateTime; const CopiarDetalles: Boolean = True) : Boolean; overload; +var + AFacturasNuevas : IBizFacturaCliente; + i: Integer; +begin + Result := False; + + if not Assigned(AFacturaProforma) then + raise Exception.Create('Factura proforma no asignada (GenerarFacturaCliFacProforma)'); + + if not AFacturaProforma.DataTable.Active then + AFacturaProforma.DataTable.Active := True; + + if not Assigned(AFacturasProformaController) then + Inicializar; + + try + AFacturasNuevas := AFacturasClienteController.Nuevo(False); + if GenerarFacturas(AFacturasNuevas, AFacturaProforma, FechaFacturaNueva, CopiarDetalles) then + begin + if AFacturasNuevas.DataTable.RecordCount = 1 then + ShowInfoMessage('La factura se ha dado de alta con el código ' + AFacturasNuevas.REFERENCIA) + else begin + with dmGenerarFacturasCliFacProforma.JsListaFacturasGeneradas.Content do + begin + Clear; + AFacturasNuevas.DataTable.Last; + for i := 0 to AFacturasNuevas.DataTable.RecordCount - 1 do + begin + if Length(AFacturasNuevas.REFERENCIA) > 0 then + Add(AFacturasNuevas.REFERENCIA + ': ' + AFacturasNuevas.NOMBRE); + AFacturasNuevas.DataTable.Prior; + end; + end; + dmGenerarFacturasCliFacProforma.JsListaFacturasGeneradas.Execute; + end; + + Result := True; + end; + + finally + AFacturasNuevas := NIL; + if Assigned(AFacturasProformaController) then + Finalizar; + end; +end; + +function GenerarFacturaCliFacProforma : Boolean; overload; +var + AFacturasProforma : IBizFacturaProforma; + AFechaFactura: TDateTime; +begin + Result := False; + try + if not Assigned(AFacturasProformaController) then + Inicializar; + +// AFacturasProforma := AFacturasProformaController.ElegirFacturasProforma(AFacturasProformaController.BuscarSinFacturar, +// 'Elija la factura proforma que desea utilizar para dar de alta la factura.' , True); + + if Assigned(AFacturasProforma) then + begin + //Preguntamos la fecha que deseamos tengan las facturas a generar + with TfEditorFechaFacturaFinal.Create(Nil) do + begin + ShowModal; + AFechaFactura := eFechaFactura.Date; + Free; + end; + + Result := GenerarFacturaCliFacProforma(AFacturasProforma, AFechaFactura); + end; + + if Assigned(AFacturasProformaController) then + Finalizar; + finally + AFacturasProforma := Nil; + end; +end; + +function GenerarFacturas(AFacturas : IBizFacturaCliente; AFacturaProforma : IBizFacturaProforma; FechaFacturaNueva:TDateTime; const CopiarDetalles: Boolean = True): Boolean; +var + AFacturaActual : IBizFacturaCliente; + AFacturasProformaController : IFacturasProformaController; + I: Integer; + bEnEdicion : Boolean; +begin + // ATENCIÓN!!! AFacturas tiene que estar vacio para no pisar facturas + // ya generadas. + if not Assigned(AFacturas) then + raise Exception.Create ('Factura no asignada (Anadir)'); + + if not Assigned(AFacturaProforma) then + raise Exception.Create ('FacturaProforma no asignada (Anadir)'); + + if not AFacturas.DataTable.Active then + AFacturas.DataTable.Active := True; + + if not AFacturaProforma.DataTable.Active then + AFacturaProforma.DataTable.Active := True; + + AFacturasProformaController := TFacturasProformaController.Create; + try + // Ordenar por fecha de albaran + AFacturaProforma.DataTable.Sort([fld_FacturasProformaFECHA_FACTURA], [uDADataTable.sdAscending]); + AFacturaProforma.First; + for I := 0 to AFacturaProforma.DataTable.RecordCount - 1 do + begin + AFacturaProforma._Cliente := NIL; + AFacturaActual := NIL; + + // Creo una factura nueva + AFacturasClienteController.Anadir(AFacturas); + //Asignamos a la factura la fecha pasada por parametro + AFacturas.FECHA_FACTURA := FechaFacturaNueva; + AFacturas.BASE_IMPONIBLE := AFacturaProforma.BASE_IMPONIBLE; + AFacturas.DESCUENTO := AFacturaProforma.DESCUENTO; + AFacturas.IMPORTE_DESCUENTO := AFacturaProforma.IMPORTE_DESCUENTO; + AFacturas.IVA := AFacturaProforma.IVA; + AFacturas.IMPORTE_IVA := AFacturaProforma.IMPORTE_IVA; + AFacturas.RE := AFacturaProforma.RE; + AFacturas.IMPORTE_RE := AFacturaProforma.IMPORTE_RE; + AFacturas.IMPORTE_TOTAL := AFacturaProforma.IMPORTE_TOTAL; +// AFacturas.OBSERVACIONES := AFacturaProforma.OBSERVACIONES; + AFacturas.ID_CLIENTE := AFacturaProforma.ID_CLIENTE; + AFacturas.NIF_CIF := AFacturaProforma.NIF_CIF; + AFacturas.NOMBRE := AFacturaProforma.NOMBRE; + AFacturas.ID_DIRECCION := AFacturaProforma.ID_DIRECCION; + AFacturas.CALLE := AFacturaProforma.CALLE; + AFacturas.POBLACION := AFacturaProforma.POBLACION; + AFacturas.CODIGO_POSTAL := AFacturaProforma.CODIGO_POSTAL; + AFacturas.ID_FORMA_PAGO := AFacturaProforma.ID_FORMA_PAGO; + AFacturas.IMPORTE_NETO := AFacturaProforma.IMPORTE_NETO; + AFacturas.IMPORTE_PORTE := AFacturaProforma.IMPORTE_PORTE; + AFacturas.ID_TIPO_IVA := AFacturaProforma.ID_TIPO_IVA; + AFacturas.RECARGO_EQUIVALENCIA := AFacturaProforma.RECARGO_EQUIVALENCIA; + AFacturaActual := AFacturas; + + //Importante recuperamos el objeto cliente para que no nos falle el procesamiento de la factura + AFacturasClienteController.RecuperarCliente(AFacturaActual); + AFacturaActual.Cliente.DataTable.Active := True; + + + // Ya tengo la factura. Le añado los conceptos de la factura proforma + AFacturaActual.Detalles.DataTable.Last; + + //Se pone la referencia de la factura proforma y el total y nos olvidamos de los detalles + if not CopiarDetalles then + begin + AFacturasClienteController.DetallesController.Add(AFacturaActual.Detalles, TIPO_DETALLE_CONCEPTO); + with AFacturaActual.Detalles do + begin + Edit; + CONCEPTO := 'Factura proforma ' + AFacturaProforma.REFERENCIA + ' - ' + DateToStr(AFacturaProforma.FECHA_FACTURA); + CANTIDAD := 1; + IMPORTE_UNIDAD := AFacturaProforma.IMPORTE_TOTAL; + Post; + end; + end + //Se copian los detalles de la factura proforma a la factura + else + // Añado el contenido de la factura proforma + CopiarArticulosFacturaProforma(AFacturaProforma.Detalles, AFacturaActual.Detalles); + + + // Guardo la factura que acabo de generar o editar + AFacturaActual.CalcularImporteTotal; + AFacturasClienteController.Guardar(AFacturaActual); + // Asocio la factura con la factura proforma + AFacturaProforma.Edit; + AFacturaProforma.ID_FACTURA_FINAL := AFacturaActual.ID; + AFacturaProforma.Post; + AFacturasProformaController.Guardar(AFacturaProforma); + + AFacturaProforma.Next; + end; + Result := True; + finally + AFacturasProformaController := NIL; +// HideHourglassCursor + end; +end; + +end. diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dpk b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dpk new file mode 100644 index 0000000..329676a --- /dev/null +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dpk @@ -0,0 +1,40 @@ +package PedCli_FacProforma_relation; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$IMPLICITBUILD OFF} + +requires + rtl, + Contactos_model, + Contactos_controller, + PedidosCliente_model, + PedidosCliente_controller, + Base, + FacturasProforma_model, + FacturasProforma_controller; + +contains + uGenerarFacturasProformaUtils in 'uGenerarFacturasProformaUtils.pas' {dmGenerarFacturasProforma}; + +end. diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dproj b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dproj new file mode 100644 index 0000000..b6ce262 --- /dev/null +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.dproj @@ -0,0 +1,654 @@ + + + + {69494a8c-0a35-41ea-b8ec-ea790bfc0662} + PedCli_FacProforma_relation.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\Output\Debug\Cliente\PedCli_FacProforma_relation.bpl + + + 7.0 + False + False + 0 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + RELEASE + + + 7.0 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borland Sample Components + Delphi 1.0 Compatibility Components + Borland MyBase DataAccess Components + TeeChart Components + Borland SimpleDataset Component (DBX) + ExpressBars extended items by Developer Express Inc. + ExpressBars by Developer Express Inc. + ExpressScheduler 2 by Developer Express Inc. + ExpressVerticalGrid by Developer Express Inc. + ExpressBars DBNavigator by Developer Express Inc. + ExpressBars extended DB items by Developer Express Inc. + ExpressSideBar by Developer Express Inc. + JVCL Band Objects + JVCL Non-Visual Components + JVCL Encryption and Compression Components + JVCL Dialog Components + JVCL Docking Components + JVCL DotNet Controls + JVCL EDI Components Designtime Package + JVCL HMI Controls design time unit + JVCL Interpreter Components + JVCL Jans Components + JVCL Managed Threads + JVCL Multimedia and Image Components + JVCL Network Components + JVCL Page Style Components + JVCL Plugin Components + JVCL Print Preview Components + JVCL Runtime Design Components + JVCL Time Framework + JVCL Unified Interbase Components + JVCL Validators and Error Provider Components + SMImport suite: data importing into dataset. Scalabium/Mike Shkolnik, 2000-2005 + SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004. + Intraweb 8.0 Design Package for Borland Development Studio 2006 + Internet Explorer Components + PedCli_FacProforma_relation.dpk + + + + + MainSource + + + + + + + + + + +
dmGenerarFacturasProforma
+
+
+
+ diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.rc b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.rc new file mode 100644 index 0000000..153736a --- /dev/null +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/PedCli_FacProforma_relation.rc @@ -0,0 +1,22 @@ +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +FILEFLAGSMASK 0x3FL +FILEFLAGS 0x00L +FILEOS 0x40004L +FILETYPE 0x1L +FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "0C0A04E4" + BEGIN + VALUE "FileVersion", "1.0.0.0\0" + VALUE "ProductVersion", "1.0.0.0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0C0A, 1252 + END +END diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.dfm b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.dfm new file mode 100644 index 0000000..37cf59a --- /dev/null +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.dfm @@ -0,0 +1,313 @@ +object dmGenerarFacturasProforma: TdmGenerarFacturasProforma + OldCreateOrder = False + Height = 176 + Width = 254 + object JsListaFacturasProformaGeneradas: TJSDialog + DialogOptions = [doCommandLinks, doModal] + Glyph.Data = { + 0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00 + 00001C0806000000720DDF940000000970485973000017120000171201679FD2 + 520000000467414D410000B18E7CFB5193000003104944415478DAAD96FB4B14 + 5114C7CFE463DC1E606444BFF54424D3DC55CA52B1CCD7165A219905054182FD + 1452FD5810FD100406610A669A998FC4F5BDB6266265DAB60F5DD15E58FE03B2 + 3F99D29ABBA7B9779C71C61D9D6177CFCE70CFDCB97B3EF7DCF3BD33C38082FD + B502B2B300CC656020048688A24F036233A0671F40D43160BA87BF62AEEE1010 + 60D7AE293AD8B835815E9B625C80DC8F1E88D4A7C1E8C1FB8F9FD6C3C44035B3 + 21500A65F6D700FE2EA580A5EC551F4A50359316B31D76EFDC0EE5F72A645045 + A067AE0623074B8140891108F1057064CC0D556053DF173812B707E6DCF332A8 + 225080D201DB4AF99BF335B4D502F371415BCC364833C4C29F458F0C2A031281 + 081734AB0B3C88403C1E6E3E2E7960F6A8FFD27A7D3EF07A11DA2C76C84A8D87 + A57FCB32E8B8A54A4C8C21B59365C9015996EF2240B6634DF435B51460A46D1F + 70C093AA46BF09C980C12CA914E6F371ADD707EF1DB3B0B0B8006EB79B8EA96B + EA5106121851245129118FD8BFA2DC5C53C6BAF5EBBBBA97C2D64EC064195B1F + 286C76E956A0EA5C51AEB4764A9929F5750D5A9581D2274B9B651C0BA2F514A8 + 6F28E36B70AD9A4253EF97A9AA55B0CEBA87D03B645B3F43C1DE589C58186D10 + 81150FCAC57B11E161B04517099BB953C78643141B01BA28EEE4DAB0B04DE2B8 + CA460B9C399902E661BB3AB0F5AD038BF30CD4D7E7DD14815A61023027DD00EF + 469C1A80FD1C307F1578FD4A81E665945AD68924181A9D5007B6F4DBF1527E32 + F5C9D3632351F8F549AEE916B14EAA039BCD362C31A6040D23E7887D4A03B0CF + 86C5C6641A24BB7646D3F2D51A77F8C1BCDCFFC79CD3EAC0D7BD56AE86294165 + 4660CB5C6B737DD3062CCA31D00069E76E05241862CF1EDD05E7D40F756063CF + 673C7F5A4F679A59541EF03E4C8C3B0893DF67D481AFBAC7B0F05412CD30EBE2 + ED80F7617CEC0198FEF94B1BF06C6622AD4B4EC99D80F7A1666043D7281A3312 + FD84C20B8417C3AA789405239826E0CBCE4F98979E10344C33B0BE630473D312 + 82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA + 1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082} + Instruction.Text = 'Se ha generado el albar'#225'n de cliente' + Instruction.Glyph.Data = { + 0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00 + 00001C0806000000720DDF940000000970485973000017120000171201679FD2 + 520000000467414D410000B18E7CFB5193000003104944415478DAAD96FB4B14 + 5114C7CFE463DC1E606444BFF54424D3DC55CA52B1CCD7165A219905054182FD + 1452FD5810FD100406610A669A998FC4F5BDB6266265DAB60F5DD15E58FE03B2 + 3F99D29ABBA7B9779C71C61D9D6177CFCE70CFDCB97B3EF7DCF3BD33C38082FD + B502B2B300CC656020048688A24F036233A0671F40D43160BA87BF62AEEE1010 + 60D7AE293AD8B835815E9B625C80DC8F1E88D4A7C1E8C1FB8F9FD6C3C44035B3 + 21500A65F6D700FE2EA580A5EC551F4A50359316B31D76EFDC0EE5F72A645045 + A067AE0623074B8140891108F1057064CC0D556053DF173812B707E6DCF332A8 + 225080D201DB4AF99BF335B4D502F371415BCC364833C4C29F458F0C2A031281 + 081734AB0B3C88403C1E6E3E2E7960F6A8FFD27A7D3EF07A11DA2C76C84A8D87 + A57FCB32E8B8A54A4C8C21B59365C9015996EF2240B6634DF435B51460A46D1F + 70C093AA46BF09C980C12CA914E6F371ADD707EF1DB3B0B0B8006EB79B8EA96B + EA5106121851245129118FD8BFA2DC5C53C6BAF5EBBBBA97C2D64EC064195B1F + 286C76E956A0EA5C51AEB4764A9929F5750D5A9581D2274B9B651C0BA2F514A8 + 6F28E36B70AD9A4253EF97A9AA55B0CEBA87D03B645B3F43C1DE589C58186D10 + 81150FCAC57B11E161B04517099BB953C78643141B01BA28EEE4DAB0B04DE2B8 + CA460B9C399902E661BB3AB0F5AD038BF30CD4D7E7DD14815A61023027DD00EF + 469C1A80FD1C307F1578FD4A81E665945AD68924181A9D5007B6F4DBF1527E32 + F5C9D3632351F8F549AEE916B14EAA039BCD362C31A6040D23E7887D4A03B0CF + 86C5C6641A24BB7646D3F2D51A77F8C1BCDCFFC79CD3EAC0D7BD56AE86294165 + 4660CB5C6B737DD3062CCA31D00069E76E05241862CF1EDD05E7D40F756063CF + 673C7F5A4F679A59541EF03E4C8C3B0893DF67D481AFBAC7B0F05412CD30EBE2 + ED80F7617CEC0198FEF94B1BF06C6622AD4B4EC99D80F7A1666043D7281A3312 + FD84C20B8417C3AA789405239826E0CBCE4F98979E10344C33B0BE630473D312 + 82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA + 1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082} + Instruction.Icon = tdiCustom + CustomButtons = < + item + Caption = 'Ver la factura proforma' + Value = 100 + Info.Strings = ( + 'Mostrar la factura proforma que se ha creado') + end> + ButtonBar.Buttons = [cbOK] + ButtonBar.Cancel = cbOK + ButtonBar.UseCancel = False + MainIcon = tdiCustom + Title = 'FactuGES' + Position = dpMainFormCenter + Icon.Data = { + 0000010003002020100001000400E8020000360000002020000001000800A808 + 00001E0300002020000001002000A8100000C60B000028000000200000004000 + 0000010004000000000000020000000000000000000000000000000000000000 + 000000008000008000000080800080000000800080008080000080808000C0C0 + C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000 + 0000000000000000000000000000000008777777777777777777777700000000 + 0877767777677776777767760000000008F88888888888888888888700000000 + 08F8FF8F8F888888888888860000000008FF8F8F88F8F8888888888C00000000 + 08F88888F8888888888888860000000008F8688878E8888E88E8788700000000 + 08F8688888F8F8FFFFFF88760000000008FF4888888F8FFFFFFF788700000000 + 08F8676767677677677658E50000000008FF8888888887878787888700000000 + 08FF8887887E8888888888860000000008FFE8E8E788C8E8FF8F8F8600000000 + 08FFF8F8F8F8FF8F88F8F8870000000008FFFFFF8FF8F8F8F88F888600000000 + 0FF8477878787878788788860000000008FF68888888F8FF8F8F788700000000 + 08B7588888FF8FFFFFFF78860000083008BB47887776777777776F86000000B7 + 8B9B73BB88788787E87878870000008BB8B9BB78888888EFF8F8FF8600000087 + B8BB8B888E8E8E88FFF8F886000000088BBB888FFFFFFFFFF8F877770000B9BB + B8FFBB9B9BFFFFFFF87466460000BBB9BB8FBBBBB8FFFFFFF88F888700000008 + B8BB88888FFFFFFFF88F8F7700000008BBBBBB8FFFFFFFFFFF8887700000007B + B7B98BB8FFFFFFFFF8887700000000B78B9B87B888F88F88F8877000000007B0 + 08BB883B78888788787700000000000000B9000000000000000000000000FFFF + FFFFF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000F9800000FC000000FC000000FC000000FE000000F0000 + 000F0000000FE000000FE000001FC000003FC000007F980000FFFCFFFFFF2800 + 0000200000004000000001000800000000000004000000000000000000000001 + 00000001000000000000694731007C5D49007E604C0081635000826451008567 + 540085685500886B5900896D5B008A6E5D008B705F008E715F008B7260008C72 + 61008E74640084766C00957A6900977D6D00887B72009A8171009D8272009C84 + 76009D8778009F897B00A28A7900A08B7D00A18C7E00E1B06E00E1B67D003E7A + 970073A0A5007AA2B70074AFBD007BB2BB003CAACE0028A5DB0020ADDF000D9A + E500209EE3000DA6E2001AA4EF0000A6FF000CABFE0009ACFE0010A4F10015AC + FA0000B5FB0000B0FD000CB6FC0000BFF90000BAFD0004BAFD0009BBFB0013B6 + F40015BFFA001CBDFB0026B7FD00589EC50040A4CD0040ABCC0050A2C7005DAE + C00060A3C20062A4C60060B7CB006AB0CD007BB6C80077BAC80061BADD0044AD + E50000C3F80007C6FB0000CAF80000CFFB0000D4F90026C8FA0026CDF8002BCC + F90039C4FB0039C2FC0039CAFA003FCFFB0024D6F80030D2F80039D5F80000F8 + F8001FF8F8002CF6F8003EF4F8005AC6DC0070CDDF0052C0E40054C9E3004DCE + FA005FC7FF004FD2FB004DD9F8005FD9FB006ED3E70063CDFE0060D1FB0060D8 + F90060DDF80046F8F90056F0F8005FFAFA0073E3F80073E4F90073EEF80060F1 + F800958A84009A918C0081999500A68F8200AD968500A3968C00AE988900AD9A + 8D00B19A8B00AF9C9000B09E9200B59F9200B7A29300B2A19600B5A19400B7A4 + 9700BDA79700B4A39800B1A59D00B4A79F00BAA69800BCA79900B4A89F00BCA8 + 9900BAA89C00BDAA9D00BEAC9E0083ADBD00B5A9A100BDABA000BEADA100BFAF + A500A0BABE00C0AB9E00C1AC9E00C6AE9F00E2B98100E4BA8300E4BB8400E5BC + 8500E1BD8E00E3BF9000C0ADA000C2B0A300C2B1A500C4B2A600C1B2A800C3B5 + AB00C8B4A800CCB9AD00CEBCB100D0BEB200D1BFB400E4C19300E5C29400E6C4 + 9600E8C69900D0C9A300CFC1B800D2C1B600D3C3B800D5C4B900D6C6BC00D8C6 + BC00D6C8BE00DAC9BF00ECD3B000EDD4B200EFD6B500E7D1B800E7D3BD00F0D8 + B6008CB7C40080BEC70097C3C70099C3C900ABD7CF00AFD9DD0086E3F90086E7 + F90086ECF8009EE5FB0090E8F900ACEDFC00BCEAFD00BCF1FB00BFF1FD00D7C9 + C000D9CAC100DCCBC200DACCC200DDCCC300DACCC400DDCEC400DED0C600DED1 + C900DED3CC00DFD4CD00E1D1C900E2D5CD00F0DCC200E3D8D200E5D9D200E2DA + D500E6DBD400E5DCD500E8DDD600E6DDD800E9DFD900E6E0DB00EAE0DA00EAE2 + DD00ECE3DE00EBE4DE00ECE4DE00F3E7D900C6E1EF00C9EFFD00D7F6FD00DFF3 + FF00DFFEFE00EBE7E300EDE6E100EFE7E400EEE8E400F0EAE600F2EDE900F2EE + EC00F4EFEC00F5F0EE00F9F4ED00E7FAFD00EBF8FF00F6F2F000F7F4F100F8F4 + F200F9F7F500FAF8F600FBF9F900FCFBFA00FCFCFB00FEFEFE00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000007D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D + 0D0D0000000000000000009C9C19191919191919191919191919191919191919 + 1903000000000000000000ABDECBCBC7C7AFABABABABAAA3A2A2A0A0A0A0A0A0 + 8607000000000000000000ABECEAE9DEDEDEDED7D5D2D2D2CBCBCBCBB0CBB0CB + 9007000000000000000000ABEDECEAE9DEDEDBD7D7D5D2D2D2CDCDCBB0B0B0B0 + 9007000000000000000000AFEDE9A9CFD2CFD2CDCBCBCBB0B0ABACA3A3A3A3B0 + 9007000000000000000000AFF0D5017783838386868686869099909999907BB0 + 9007000000000000000000B0F4D501A0B0CBD2D5DEECEDF7FAFAFAFAFAF77BAA + 9007000000000000000000CBF4DC01A0B0B0B0D2D5DBEAEDF7FAFAFAFAF47BB0 + 9007000000000000000000CBF8DC010404070604090909090D0D110D110D02A3 + 9007000000000000000000CBFAED9E9E9E9C999E8C8C8C868683837E7D7D7ACB + 9007000000000000000000CBFAF1A7A7A6A6A6A69898989898B5DBDBD5D5D2D2 + 9907000000000000000000CDFAF796969696961D961D931D1DB4DEDBD7D5D5D2 + 9C07000000000000000000CFFAFAFAFAF8F7F0F0EDEDEDECE9E9DEDEDED7D5D5 + 9907000000000000000000CDFAFAEAF0EDEDECEAEAE9DEDEDBDCD5D5D5D5D2D5 + 9C07000000000000000000D2FAEC01737D7D7B7D7D7B7D7B7D7B7B7B7D7B7DD2 + 9907000000000000000000CFFAEC019EABB0CBD2D5DCDEECEDF4F4F4F4EA7BD2 + 9C07000000000000000000B9524601A0B0B0CBB5D5DEEAEDF7FAFAFAFAF47DD5 + 9C070000000000213F0000B83226010C3F5C1F111214141616191B1B1B1807D2 + 9C07000000000000253D8A5B322D711E2860BA7E7E7A7E797A797979767676D5 + 9E0700000000000041375E662F2B65314EBBB6B6B6B6B4B4B1E2F4EDEDEDECEA + 9C070000000000008F5D66663232394EC1A81C1C1C1C1C1C1CD3F7F4EDDED7D5 + 9C0700000000000000B7BE6E5758BEBDE4E6E6F3FAFAFAFAFAFAF7F4D5928675 + 7304000000002A2A2A2A4A6AFAE7562F2A2A2A5FFAFAFAFAFAFAF8D577010101 + 0101000000004747472F4A59C5E7564A32474766FAFAFAFAFAFAFADCA0D2CFB0 + A20C00000000000000436C6958686D6BC2C5C5E7FAFAFAFAFAFAFADEAADEDBCB + 1470000000000000004551534A4A5250C0E7FAFAFAFAFAFAFAFAFADEAAD7B514 + 700000000000000042384C54472B613550C3FAFAFAFAFAFAFAFAFADEA1B0196F + 000000000000000024234463322EBC5A3664E3ECE9E9E9E9E9E9E9CF90731300 + 000000000000003A3C00002232298B8B3E3B207E8B7E8B7E827E817E74100000 + 0000000000000000000000003227000000000000000000000000000000000000 + 000000000000FFFFFFFFF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000FF800000FF800000FF800000FF800 + 000FF800000FF800000FF800000FF800000F9800000FC000000FC000000FC000 + 000FE000000F0000000F0000000FE000000FE000001FC000003FC000007F9800 + 00FFFCFFFFFF2800000020000000400000000100200000000000801000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000007067 + 5F70AA9382E570513CE3735540E3735540E3735540E3735540E3735540E37355 + 40E3735540E3735540E3735540E3735540E3735540E3735540E3735540E37355 + 40E3735540E3735540E3735540E3735540E3735540E3735540E372533EE5BAAB + A070000000000000000000000000000000000000000000000000000000005E54 + 4C7FCAB7ABFFC5B5AAFFA18877FFA28A78FFA28A79FFA28A79FFA28A79FFA28A + 79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A + 79FFA28A79FFA28A79FFA28A79FFA28A79FFA28A79FFA58D7CFF7A5B46FFB2A1 + 967F000000000000000000000000000000000000000000000000000000006055 + 4D7ED7C6BBFFEDE4E0FFD9CCC4FFD9CCC4FFD9CBC3FFD8CAC1FFD7C9BFFFD6C7 + BDFFD5C6BBFFD4C4BAFFD3C3B8FFD2C1B7FFD1C0B5FFD0BEB3FFCFBDB2FFCEBC + B0FFCEBBAFFFCEBBAFFFCEBBAFFFCEBBAFFFCEBCB0FFBEAA9CFF82644FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006056 + 4D7ED7C8BCFFF2EBE8FFEFE9E5FFEEE7E2FFECE5E0FFEBE2DEFFEAE0DBFFE9DE + D8FFE7DBD4FFE5D9D1FFE3D7CFFFE2D4CCFFE1D2C9FFDFD0C7FFDDCDC4FFDCCB + C2FFDBC9BFFFDBC9BFFFDBC9BFFFDBC9BFFFDCCAC1FFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006155 + 4E7ED8C9BDFFF3EDE9FFF1EAE6FFF0E9E6FFEEE6E1FFECE4DFFFEBE2DDFFEAE0 + DAFFE9DED7FFE7DBD4FFE5D9D1FFE3D7CFFFE2D4CCFFE1D2C9FFDFD0C7FFDDCD + C4FFDCCBC2FFDBC9BFFFDBC9BFFFDBC9BFFFDCCAC0FFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006157 + 4E7ED9C9BFFFF4EFEDFFEFE8E3FFD0C2B9FFDFD5CEFFE0D5CEFFE0D4CCFFDED3 + CBFFDDD1C8FFDCCFC6FFDACCC4FFD9CBC1FFD8C9BFFFD7C7BDFFD6C5BBFFD5C4 + B9FFD3C2B7FFD2C0B5FFD2BFB4FFD2BFB4FFDAC8BEFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDACCC0FFF5F2EFFFE5DDD9FF5C3821FFB0998AFFB8A394FFB8A394FFB9A3 + 94FFB8A495FFB9A597FFB9A698FFBAA698FFBBA799FFBBA89AFFBBA89BFFBCA8 + 9BFFBCA89BFFBCA89BFFBBA89AFFB49E8FFFD8C6BBFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDBCBC1FFF8F4F3FFE7E0DBFF5F3C24FFD0BDB2FFDCCBC1FFDDCCC3FFE2D2 + CBFFE7DBD4FFEDE2DEFFF0E8E6FFF5F0EDFFF9F7F4FFFDFDFDFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFAF8F7FFB39D8DFFD8C6BBFFC1AC9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006256 + 4F7EDCCEC3FFFAF6F5FFE9E2DDFF5F3C24FFD2BFB5FFDFCDC4FFDECCC3FFE0CE + C6FFE4D4CDFFE9DDD6FFEFE4E0FFF1EAE8FFF7F1EFFFFBF8F6FFFFFEFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFCFBFAFFB5A090FFD9C7BEFFC1AD9FFF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006257 + 4F7EDDCFC4FFFCF9F9FFE9E4E0FF5F3A23FF7C5D49FF7F5F4CFF7E5F4CFF7E60 + 4DFF7F614DFF816350FF826552FF836654FF846856FF856A57FF866B59FF876C + 5BFF876D5BFF876D5BFF866B59FF72523DFFD5C3B9FFC1AFA1FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006357 + 507EDECFC6FFFCFCFBFFF4F1F0FFC3B6AEFFC3B5ADFFC1B4ACFFC0B3AAFFBFB1 + A9FFBEB0A6FFBDAEA5FFBDACA3FFBCABA2FFBBAAA0FFBAA99FFFB8A69AFFB8A4 + 98FFB6A396FFB5A194FFB49F93FFB39D90FFDCCDC4FFC2AEA1FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006357 + 507EDFD2C7FFFEFEFDFFF9F5EFFFE8C696FFE9C799FFE8C697FFE7C596FFE7C4 + 95FFE6C394FFE5C293FFE4C091FFE4C090FFE3BF8FFFE2BD8CFFE9D5BFFFEBE1 + DCFFEADFD8FFE7DCD5FFE5DAD3FFE4D8D0FFE3D4CCFFC2AFA2FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006458 + 517EE0D3C8FFFFFFFFFFFAF5EFFFE3B77CFFE4B97FFFE2B87EFFE3B77DFFE2B7 + 7CFFE2B67BFFE1B57AFFE1B479FFE0B478FFE0B377FFDFB174FFE6D0B7FFEBE1 + DCFFE8DFD9FFE8DDD6FFE6D9D2FFE3D8D1FFE4D7CFFFC3AFA2FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006458 + 517EE1D2C9FFFFFFFFFFFEFEFDFFFEFFFFFFFCFDFEFFFBFBFBFFF9F7F8FFF8F5 + F6FFF7F3F2FFF5F1F0FFF4EFEEFFF1EDEBFFF0EBE9FFEEE9E6FFEDE6E2FFECE3 + DEFFEBE1DBFFE9DFD9FFE8DDD6FFE6DAD3FFE5D9D2FFC3B0A3FF81634FFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006459 + 517EE1D4CAFFFFFFFFFFFDFDFCFFEEEBE8FFF5F2F0FFF4F0EFFFF3EFECFFF2ED + EAFFF1EBE8FFEEE9E5FFEFE7E3FFECE5E1FFEAE4DEFFEAE1DCFFE8E0DAFFE7DE + D8FFE6DDD6FFE5DBD4FFE4D8D1FFE2D6CEFFE6DBD4FFC3B1A4FF81634EFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006559 + 527EE2D4CAFFFFFFFFFFF0ECEAFF5B361EFFAB9383FFB39D8EFFB39D8DFFB39D + 8DFFB29D8DFFB29C8DFFB29C8CFFB29C8CFFB29C8CFFB29C8CFFB29C8CFFB29C + 8CFFB29C8CFFB29C8CFFB29C8DFFB39D8EFFE3D8D0FFC4B1A4FF81634EFFB2A1 + 967E000000000000000000000000000000000000000000000000000000006559 + 527EE5D4CAFFFFFFFFFFF7F0EBFF5F3B24FFCCB8ADFFD7C5BAFFD9C7BDFFDCCC + C3FFE1D4CCFFE5DAD4FFE8E0DBFFEDE5E1FFF1EBE9FFF5F2EFFFF7F5F3FFF8F6 + F4FFF8F5F4FFF8F6F4FFF1EEEAFFB29C8DFFE6DAD3FFC4B2A5FF81634EFFB2A1 + 967E00000000000000000000000000000000000000000000000000000000685A + 527E9AC6C9FF35CFFEFF3DAEEBFF663E24FFD2BFB4FFE0CBBFFFE0C9BDFFE1CD + C4FFE4D5CDFFE9DED7FFEEE5E0FFF2EBE8FFF6F2F0FFFCF8F8FFFFFFFEFFFFFF + FFFFFFFFFFFFFFFFFFFFFCFAF9FFB49E8FFFE7DED7FFC5B3A6FF81634EFFB2A1 + 967E00000000000000000000000000000000007792910072A7A3001E33366957 + 4C7C86C1C8FF00BFFBFF079AEBFF6A3E23FF926D57FF5FA3C8FF4AC1E8FF6C9C + A2FF917260FF927767FF947A69FF957C6CFF977E6FFF998171FF9A8374FF9B85 + 76FF9C8678FF9C8678FF998274FF7D5E49FFE3D9D4FFC5B3A7FF81634EFFB2A1 + 967E00000000000000000000000000000000005A6F7000A9E5E40075AEAE5C90 + A5BD75D0E0FF00BFFAFF0CA3F4FF8A9A91FF3C7492FF03A4E4FF4AD5FFFF98C4 + CBFFB3A196FFB1A197FFB0A096FFB09F95FFAF9D92FFAF9C91FFAD9A8EFFAC99 + 8CFFAB988AFFAB9789FFAA9688FFA99386FFE8E0DAFFC5B4A7FF81634EFFB2A1 + 967E00000000000000000000000000000000000000002DA5BFC110C2FFFF4DD0 + FDFF64DBF9FF00B3FAFF09A8FEFF68D7FFFF04B5FFFF24CCFBFFAFD8CEFFF7DA + B8FFF3DBBBFFF3DBBAFFF2D9B9FFF1D8B7FFF0D7B4FFEED5B2FFF6EADDFFF9F6 + F4FFF7F3F1FFF5F1EEFFF5EFECFFF4EDEAFFF1EBE7FFC6B4A8FF81634EFFB2A1 + 967E00000000000000000000000000000000000000005F8A909142C7E4E960DE + F8FF64D7FAFF00B6FDFF00B8FDFF21B2FDFF1ECCF7FF93EBFCFFD2C69BFFE1AB + 63FFDFAC66FFDFAC66FFDFAC66FFDFAC66FFDFAC66FFDEA961FFEFDBC0FFF8F6 + F5FFF6F2F0FFF3EDEBFFECE2DCFFE9DFD9FFE5DBD6FFC2B1A4FF81634FFFB2A1 + 967E000000000000000000000000000E171A000E171A00040B145994A4A990EB + FCFF61F1F7FF13FAF7FF23F9F7FF93EDF7FF8CE5F8FFD5F2FDFFE9F8FFFFE7F8 + FFFFF0FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFDFEFFFFFAFAF9FFF9F7 + F5FFF7F2F0FFE8DFD8FFC7AE9FFFBEA998FFAF9888FFB09A8AFF7F604DFFB2A1 + 967E00000000000000000000000000AAFFFF00AAFFFF00AAFFFF00A4FFFF00CD + FAFF5DFCF9FFFFFFFFFFEEFEFEFF00FBF7FF00AAFEFF00A1FFFF00A1FFFF00A0 + FFFF56C3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFBFFFCFBFAFFFBFA + F8FFE6DDD6FFAA9180FF5D3922FF603D26FF613E27FF613E28FF634029FFB4A3 + 987E00000000000000000000000000CAFFFF00CAFFFF00CBFFFF00B0FFFF00CD + FBFF38F5F7FFC3EFFAFFF0FFFEFF00FAF7FF00C8F7FF00C2F7FF00C2F7FF00C1 + F7FF57D7FAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFDFDFCFFFCFC + FBFFE7DED8FFCCB9ACFFE6DBD5FFE2D7D0FFDCCFC5FFD7C5BBFF8E705DFFB4A2 + 9680000000000000000000000000002E383C002E383C00252F364C99B0B57DE8 + FBFF59F1F7FF25F7F7FF41FAF8FF7CEEF7FF77E4F7FFB5EFFCFFC6F2FDFFC3F2 + FDFFD9F6FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFEFFFEFE + FEFFE9E1DAFFCEBCAFFFF1E9E3FFEADFD8FFE4D5CCFF9D816FFF3A291F868985 + 831C00000000000000000000000000000000000000004E7073774AB0DADC37C9 + FBFF22D5F7FF00D3F9FF02C3FBFF37D5F7FF34BEFCFFA2E6FAFFECFBFDFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFF + FFFFEAE2DCFFCDBBADFFEADFD8FFE3D5CBFF9F8271FF3E2D2386050100200000 + 000000000000000000000000000000000000000000003E9CC4C219C0FFFF23C9 + FCFF30D3F8FF00BEF8FF06A8FEFF4FDCF8FF00B8FCFF32C2FBFFC0EBFCFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFEAE3DEFFCDB9ABFFDDCEC4FFA58979FF3E2C1F8F0905041B000000000000 + 000000000000000000000000000000000000003451510099DDDB0091C0C35DAD + BCCF76D7E9FF00BEF9FF10A9FBFFBDDEDEFF5AC8DDFF0AB5F7FF62CEFFFFCBE4 + F1FFF1E7E0FFEFE7E1FFEEE6E1FFEEE6E1FFEEE6E0FFEDE6E0FFEDE5E0FFEEE6 + E1FFE1D4CCFFC5AE9FFFA68D7FF53E2718A10402000E00000000000000000000 + 0000000000000000000000000000000000000075B7AF0099C7C500323E425442 + 3B5C6BA8B1DA00C1FCFF0EA1F3F8A98E80C0AB9081C12698B1C10088C4C14C85 + A3C1A18D80C19E8D81C19E8B81C19D8C80C19B8C7FC19B8A7FC19C897FC19A89 + 7EC19B8B7EC1897769C2432B1BAC000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000045565A00C5FFFF0094E6E2000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFFFFF0000007F0000007F0000007F000 + 0007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F000 + 0007F0000007F0000007F0000007F0000007F0000007F0000007800000078000 + 0007C0000007C000000700000007000000070000000700000007C000000FC000 + 001F8000003F800000FFF8FFFFFF} + Width = 450 + Left = 104 + Top = 24 + end +end diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.pas b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.pas new file mode 100644 index 0000000..22892c9 --- /dev/null +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Facturas proforma/uGenerarFacturasProformaUtils.pas @@ -0,0 +1,261 @@ +unit uGenerarFacturasProformaUtils; + +interface + +uses + Windows, SysUtils, Classes, pngimage, JSDialog, + uBizPedidosCliente, uBizFacturasProforma; + +type + TdmGenerarFacturasProforma = class(TDataModule) + JsListaFacturasProformaGeneradas: TJSDialog; + end; + + function GenerarFacturaProforma(const IDPedido : Integer) : Boolean; overload; + function GenerarFacturaProforma(APedido : IBizPedidoCliente; var AFactura: IBizFacturaProforma) : Boolean; overload; +// function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; + +implementation + +{$R *.dfm} + +uses + uDialogUtils, uBizDetallesPedidoCliente, uBizDetallesFacturaProforma, + uPedidosClienteController, uFacturasProformaController, uClientesController, + uDetallesFacturaProformaController, uControllerDetallesBase, + uBizContactos, schPedidosClienteClient_Intf, + schFacturasProformaClient_Intf, uDataTableUtils; + +var + dmGenerarFacturasProforma: TdmGenerarFacturasProforma; + APedidosClienteController : IPedidosClienteController; + AFacturasProformaController : IFacturasProformaController; + ADetallesFacturaProformaController : IDetallesFacturaProformaController; + AClientesController : IClientesController; + +{ Métodos auxiliares } +procedure CopiarPedidoAFactura(APedido: IBizPedidoCliente; AFactura : IBizFacturaProforma); +begin + if not Assigned(AFactura) then + raise Exception.Create ('Factura no asignada (CopiarPedidoAFactura)'); + + if not Assigned(APedido) then + raise Exception.Create ('Pedido no asignado (CopiarPedidoAFactura)'); + + if not APedido.DataTable.Active then + APedido.DataTable.Active := True; + + APedidosClienteController.RecuperarCliente(APedido); + APedido.Cliente.DataTable.Active := True; + AFactura.Cliente := APedido.Cliente; + AFactura.ID_PEDIDO := APedido.ID; + AFactura.IMPORTE_NETO := APedido.IMPORTE_NETO; + AFactura.IMPORTE_PORTE := APedido.IMPORTE_PORTE; + AFactura.DESCUENTO := APedido.DESCUENTO; + AFactura.IMPORTE_DESCUENTO := APedido.IMPORTE_DESCUENTO; + AFactura.BASE_IMPONIBLE := APedido.BASE_IMPONIBLE; + AFactura.IMPORTE_PORTE := APedido.IMPORTE_PORTE; + AFactura.IMPORTE_TOTAL := APedido.IMPORTE_TOTAL; + AFactura.ID_FORMA_PAGO := APedido.ID_FORMA_PAGO; +end; + +procedure CopiarDetallesAFactura(APedido: IBizPedidoCliente; AFactura: IBizFacturaProforma; + AArticulos: IBizDetallesPedidoCliente); +var + i : integer; + ADetalles : IBizDetallesFacturaProforma; + ADetallesController : IDetallesFacturaProformaController; +begin + if not Assigned(AFactura) then + raise Exception.Create ('Factura no asignada(CopiarDetallesAFactura)'); + + if not Assigned(APedido) then + raise Exception.Create ('Pedido no asignado (CopiarDetallesAFactura)'); + + if not Assigned(AArticulos) then + raise Exception.Create ('Artículos no asignado (CopiarDetallesAFactura)'); + + if not AArticulos.DataTable.Active then + AArticulos.DataTable.Active := True; + + // La factura tiene que venir ya abierto y posicionado donde hay que copiar + ADetalles := AFactura.Detalles; + ADetallesController := TDetallesFacturaProformaController.Create; + try + //OJO IMPORTANTE + //Siempre que vayamos a trabajar con los detalles debemos hacer un beginupdate de los mismos y un endupdate para + //obligarle siempre a recalcular los detalles una sola vez + ADetallesController.BeginUpdate(ADetalles); + + AArticulos.DataTable.First; + for i := 0 to AArticulos.DataTable.RecordCount - 1 do + begin + ADetallesController.Add(ADetalles, AArticulos.TIPO_DETALLE); + ADetalles.Edit; + ADetalles.REFERENCIA := AArticulos.REFERENCIA; + ADetalles.ID_ARTICULO := AArticulos.ID_ARTICULO; + ADetalles.CONCEPTO := AArticulos.CONCEPTO; + + if not AArticulos.CANTIDADIsNull then + ADetalles.CANTIDAD := AArticulos.CANTIDAD; + if not AArticulos.IMPORTE_UNIDADIsNull then + ADetalles.IMPORTE_UNIDAD := AArticulos.IMPORTE_UNIDAD; + if not AArticulos.IMPORTE_TOTALIsNull then + ADetalles.IMPORTE_TOTAL := AArticulos.IMPORTE_TOTAL; + if not AArticulos.DESCUENTOIsNull then + ADetalles.DESCUENTO := AArticulos.DESCUENTO; + if not AArticulos.IMPORTE_PORTEIsNull then + ADetalles.IMPORTE_PORTE := AArticulos.IMPORTE_PORTE; + + ADetalles.VISIBLE := AArticulos.VISIBLE; + ADetalles.REFERENCIA_PROVEEDOR := AArticulos.REFERENCIA_PROVEEDOR; + ADetalles.Post; + AArticulos.Next; + end; + + //Añadimos el importe de porte solo en el caso de que el pedido tenga. + if (APedido.IMPORTE_PORTE > 0) then + begin + AFacturasProformaController.DetallesController.Add(AFactura.Detalles, TIPO_DETALLE_CONCEPTO); + with AFactura.Detalles do + begin + Edit; + CONCEPTO := 'Porte del pedido '; + CANTIDAD := 1; + IMPORTE_UNIDAD := APedido.IMPORTE_PORTE; + Post; + end; + end; + + finally + ADetallesController.EndUpdate(ADetalles); + ADetallesController := NIL; + end; +end; + + +procedure Inicializar; +begin + dmGenerarFacturasProforma := TdmGenerarFacturasProforma.Create(nil); + APedidosClienteController := TPedidosClienteController.Create; + AFacturasProformaController := TFacturasProformaController.Create; +// ADetallesAlbaranesCliController := TDetallesAlbaranClienteController.Create; + AClientesController := TClientesController.Create; +end; + +procedure Finalizar; +begin + FreeAndNIL(dmGenerarFacturasProforma); + APedidosClienteController := nil; + AFacturasProformaController := nil; +// ADetallesFacturasProformaController := nil; + AClientesController := nil; +end; + + +function GenerarFacturaProforma(const IDPedido : Integer) : Boolean; overload; +var + APedido : IBizPedidoCliente; + AFactura : IBizFacturaProforma; +begin + Result := False; + + try + if not Assigned(APedidosClienteController) then + Inicializar; + + APedido := APedidosClienteController.Buscar(IDPedido); + if Assigned(APedido) then + Result := GenerarFacturaProforma(APedido, AFactura); + finally + if Assigned(APedidosClienteController) then + Finalizar; + end; +end; + +function GenerarFacturaProforma(APedido : IBizPedidoCliente; var AFactura: IBizFacturaProforma) : Boolean; overload; +var + ARespuesta : Integer; + AuxFactura : IBizFacturaProforma; + +begin + Result := False; + AFactura := NIL; + + if not Assigned(APedido) then + raise Exception.Create('Pedido de cliente no asignado (GenerarFacturaProforma)'); + + if not APedido.DataTable.Active then + APedido.DataTable.Active := True; + + if not Assigned(APedidosClienteController) then + Inicializar; + + try + AuxFactura := AFacturasProformaController.Nuevo; + CopiarPedidoAFactura(APedido, AuxFactura); + CopiarDetallesAFactura(APedido, AuxFactura, APedido.Detalles); + + //Sustituir por if de guardar + if AFacturasProformaController.Guardar(AuxFactura) then + begin + AFactura := AuxFactura; + with dmGenerarFacturasProforma.JsListaFacturasProformaGeneradas do + begin + Instruction.Text := 'Se ha generado la factura proforma'; + + Content.Clear; + Content.Add(Format('Se ha generado correctamente la factura proforma %s a partir del pedido de cliente' + #10#13, [AuxFactura.REFERENCIA])); + Execute; + + ARespuesta := CustomButtonResult; + case ARespuesta of + 100 : begin + // Ver la factura proforma + AFacturasProformaController.Ver(AuxFactura); + end; + 200 : // Continuar; + end; + end; + end; + + Result := True; + finally +// AArticulosPendientes := NIL; + if Assigned(APedidosClienteController) then + Finalizar; + end; +end; + +{ +function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; overload; +var + APedido : IBizPedidoCliente; + AAlbaran : IBizAlbaranCliente; +begin + Result := False; + IDAlbaran := -1; + + AAlbaran := NIL; + try + if not Assigned(APedidosClienteController) then + Inicializar; + + APedido := APedidosClienteController.ElegirPedidos(APedidosClienteController.BuscarPendientes, + 'Elija el pedido de cliente que desea utilizar para dar de alta el albarán de cliente.' + , False); + + if Assigned(APedido) then + begin + Result := GenerarAlbaranCli(APedido, AAlbaran); + if Result then + IDAlbaran := AAlbaran.ID; + end; + finally + if Assigned(APedidosClienteController) then + Finalizar; + end; +end; +} + +end. diff --git a/Source/Modulos/Tienda web/Data/TiendaWeb_data.drc b/Source/Modulos/Tienda web/Data/TiendaWeb_data.drc index b18b114..9367e3c 100644 --- a/Source/Modulos/Tienda web/Data/TiendaWeb_data.drc +++ b/Source/Modulos/Tienda web/Data/TiendaWeb_data.drc @@ -14,4 +14,4 @@ END /* C:\Codigo\Source\Modulos\Tienda web\Data\uDataModuleTiendaWeb.dfm */ /* C:\Codigo\Source\Modulos\Tienda web\Data\TiendaWeb_data.res */ -/* c:\temp\dtf340.tmp */ +/* c:\temp\dtf37C.tmp */ diff --git a/Source/Servidor/FactuGES_Server.RES b/Source/Servidor/FactuGES_Server.RES index f93bfa5..4fb4651 100644 Binary files a/Source/Servidor/FactuGES_Server.RES and b/Source/Servidor/FactuGES_Server.RES differ diff --git a/Source/Servidor/FactuGES_Server.dpr b/Source/Servidor/FactuGES_Server.dpr index 77bf602..e2cf2c6 100644 --- a/Source/Servidor/FactuGES_Server.dpr +++ b/Source/Servidor/FactuGES_Server.dpr @@ -164,10 +164,11 @@ uses schEmpresasServer_Intf in '..\ApplicationBase\Empresas\Model\schEmpresasServer_Intf.pas', srvFacturasProforma_Impl in '..\Modulos\Facturas proforma\Servidor\srvFacturasProforma_Impl.pas' {srvFacturasProforma: TDataAbstractService}, uBizFacturasProformaServer in '..\Modulos\Facturas proforma\Model\uBizFacturasProformaServer.pas', - schFacturasProformaClient_Intf in '..\Modulos\Facturas proforma\Model\schFacturasProformaClient_Intf.pas', - schFacturasProformaServer_Intf in '..\Modulos\Facturas proforma\Model\schFacturasProformaServer_Intf.pas', schContactosClient_Intf in '..\Modulos\Contactos\Model\schContactosClient_Intf.pas', - schContactosServer_Intf in '..\Modulos\Contactos\Model\schContactosServer_Intf.pas'; + schContactosServer_Intf in '..\Modulos\Contactos\Model\schContactosServer_Intf.pas', + uRptFacturasProforma_Server in '..\Modulos\Facturas proforma\Reports\uRptFacturasProforma_Server.pas' {RptFacturasProforma: TDataModule}, + schFacturasProformaClient_Intf in '..\Modulos\Facturas proforma\Model\schFacturasProformaClient_Intf.pas', + schFacturasProformaServer_Intf in '..\Modulos\Facturas proforma\Model\schFacturasProformaServer_Intf.pas'; {$R *.res} {$R ..\Servicios\RODLFile.res} diff --git a/Source/Servidor/FactuGES_Server.dproj b/Source/Servidor/FactuGES_Server.dproj index d83501c..af39e19 100644 --- a/Source/Servidor/FactuGES_Server.dproj +++ b/Source/Servidor/FactuGES_Server.dproj @@ -172,6 +172,10 @@ + +
RptFacturasProforma
+ TDataModule +
srvFacturasProforma
TDataAbstractService diff --git a/Source/Servidor/FactuGES_Server.rc b/Source/Servidor/FactuGES_Server.rc index a667426..4e4e3db 100644 --- a/Source/Servidor/FactuGES_Server.rc +++ b/Source/Servidor/FactuGES_Server.rc @@ -14,7 +14,7 @@ BEGIN BEGIN VALUE "FileVersion", "4.3.4.0\0" VALUE "ProductVersion", "4.3.4.0\0" - VALUE "CompileDate", "jueves, 05 de diciembre de 2013 12:20\0" + VALUE "CompileDate", "jueves, 12 de diciembre de 2013 16:36\0" END END BLOCK "VarFileInfo"