From 38785086a1b10ed5d6bed692c87ffda2ea5f9fbd Mon Sep 17 00:00:00 2001 From: david Date: Thu, 18 Dec 2008 15:38:42 +0000 Subject: [PATCH] =?UTF-8?q?Se=20adaptan=20las=20fichas=20de=20cliente=20y?= =?UTF-8?q?=20de=20proveedor=20para=20que=20acepten=20varios=20dias=20de?= =?UTF-8?q?=20pago=20(en=20los=20clientes=20se=20desactiva=20para=20acana)?= =?UTF-8?q?,=20ademas=20de=20retocar=20la=20l=C3=B3gica=20de=20generacion?= =?UTF-8?q?=20de=20los=20recibos=20asociados=20a=20las=20facturas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@369 f4e31baf-9722-1c47-927c-6f952f962d4b --- .../Controller/uFacturasClienteController.pas | 92 +++++++++++-------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index e2bec2fc..f001cd4d 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -119,10 +119,10 @@ type implementation uses - Windows, uNumUtils, Controls, cxControls, DB, uEditorRegistryUtils, schFacturasClienteClient_Intf, + Windows, uDateUtils, uNumUtils, Controls, cxControls, DB, uEditorRegistryUtils, schFacturasClienteClient_Intf, uBizContactos, uIEditorFacturasCliente, uIEditorFacturaCliente, uFactuGES_App, uDataModuleFacturasCliente, uBizDetallesFacturaCliente, uControllerDetallesBase, - uDataModuleUsuarios, uDAInterfaces, uDataTableUtils, uDateUtils, + uDataModuleUsuarios, uDAInterfaces, uDataTableUtils, uAlbaranesClienteController, schAlbaranesClienteClient_Intf, uROTypes, uDetallesAlbaranClienteController, uBizDetallesAlbaranCliente, uFacturasClienteReportController, // uBizPedidosCliente, uPedidosClienteController, uBizDetallesPedidoCliente, @@ -656,7 +656,8 @@ begin //De esta forma obligaremos siempre a tener un recibo asociado a la factura, //porque si la forma de pago no tiene plazos es obligatorio la fecha de vencimiento - with TFormasPagoController.Create do + //OJO-----En facturas de cliente para acana no es obligatorio porque deben de poder generar facturas sin recibos asociados +{ with TFormasPagoController.Create do begin try AFormaPago := Buscar(AFactura.ID_FORMA_PAGO); @@ -669,6 +670,7 @@ begin Free; end; end; +} if (AFactura.IGNORAR_CONTABILIDAD = 0) and ((AFactura.Cliente.SubCuentas.ID < 1) //REPASAR @@ -1159,56 +1161,66 @@ begin //Se cambia la lógica a peticion de acana, en el caso de meter una fecha de vencimiento, //los plazos de la forma de pago no tendrán efecto, se generará un recibo con el 100% y fecha de vencimiento - //de la factura. + //de la factura. (Se permitirá para acana poder dar de alta facturas sin recibos asociados) With AFormaPago.Plazos.DataTable do begin i := 1; First; repeat - ARecibos := ARecibosClienteController.Nuevo; - ARecibos.Edit; - ARecibos.ID_FACTURA := AFactura.ID; - ARecibos.ID_EMPRESA := AFactura.ID_EMPRESA; - ARecibos.ID_CLIENTE := AFactura.ID_CLIENTE; - ARecibos.ID_TIENDA := AFactura.ID_TIENDA; - ARecibos.REFERENCIA := AFactura.REFERENCIA + ' - ' + IntToStr(i); - ARecibos.NOMBRE := AFactura.NOMBRE; //Es la razon social de la factura - ARecibos.CALLE := AFactura.CALLE; - ARecibos.NIF_CIF := AFactura.NIF_CIF; - ARecibos.POBLACION := AFactura.POBLACION; - ARecibos.PROVINCIA := AFactura.PROVINCIA; - ARecibos.CODIGO_POSTAL := AFactura.CODIGO_POSTAL; - ARecibos.FECHA_EMISION := AFactura.FECHA_FACTURA; - - if AFormaPago.Plazos.RecordCount < 1 then + //SOLO PARA ACANA (Leer comentario anterior + if (AFormaPago.Plazos.RecordCount > 0) + or (AFactura.FECHA_VENCIMIENTO <> 0) then begin + ARecibos := ARecibosClienteController.Nuevo; + ARecibos.Edit; + ARecibos.ID_FACTURA := AFactura.ID; + ARecibos.ID_EMPRESA := AFactura.ID_EMPRESA; + ARecibos.ID_CLIENTE := AFactura.ID_CLIENTE; + ARecibos.ID_TIENDA := AFactura.ID_TIENDA; + ARecibos.REFERENCIA := AFactura.REFERENCIA + ' - ' + IntToStr(i); + ARecibos.NOMBRE := AFactura.NOMBRE; //Es la razon social de la factura + ARecibos.CALLE := AFactura.CALLE; + ARecibos.NIF_CIF := AFactura.NIF_CIF; + ARecibos.POBLACION := AFactura.POBLACION; + ARecibos.PROVINCIA := AFactura.PROVINCIA; + ARecibos.CODIGO_POSTAL := AFactura.CODIGO_POSTAL; + ARecibos.FECHA_EMISION := AFactura.FECHA_FACTURA; + + if AFormaPago.Plazos.RecordCount < 1 then + begin ARecibos.FECHA_VENCIMIENTO := AFactura.FECHA_VENCIMIENTO; ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL; - end - else - begin - AFechaVencimiento := AFactura.FECHA_FACTURA + AFormaPago.Plazos.NUM_DIAS; - ADiasMas := 0; - if (AFactura.Cliente.VENCIMIENTO_FACTURAS <> 0) then + end + else begin - ADiaVencimiento := DayOf(AFechaVencimiento); - while (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS) do - begin - if ADiaVencimiento = DaysInMonth(AFechaVencimiento) then - ADiaVencimiento := 1 - else - Inc(ADiaVencimiento); - Inc(ADiasMas); - end; + AFechaVencimiento := AFactura.FECHA_FACTURA + AFormaPago.Plazos.NUM_DIAS; + ADiasMas := 0; + if (AFactura.Cliente.VENCIMIENTO_FACTURAS_1 <> 0) + or (AFactura.Cliente.VENCIMIENTO_FACTURAS_2 <> 0) + or (AFactura.Cliente.VENCIMIENTO_FACTURAS_3 <> 0) then + begin + ADiaVencimiento := DayOf(AFechaVencimiento); + while (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS_1) + and (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS_2) + and (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS_3) do + begin + if ADiaVencimiento = DaysInMonth(AFechaVencimiento) then + ADiaVencimiento := 1 + else + Inc(ADiaVencimiento); + Inc(ADiasMas); + end; + end; + + AFechaVencimiento := IncDay(AFechaVencimiento, ADiasMas); + ARecibos.FECHA_VENCIMIENTO := AFechaVencimiento; + ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL * (AFormaPago.Plazos.PORCENTAJE / 100); end; - AFechaVencimiento := IncDay(AFechaVencimiento, ADiasMas); - ARecibos.FECHA_VENCIMIENTO := AFechaVencimiento; - ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL * (AFormaPago.Plazos.PORCENTAJE / 100); + ARecibos.DESCRIPCION := 'RECIBO ' + ARecibos.REFERENCIA + ' - ' + CifraToLetras(ARecibos.IMPORTE); + ARecibosClienteController.Guardar(ARecibos); end; - ARecibos.DESCRIPCION := 'RECIBO ' + ARecibos.REFERENCIA + ' - ' + CifraToLetras(ARecibos.IMPORTE); - ARecibosClienteController.Guardar(ARecibos); Inc(i); Next; until (eof);