Se adaptan las fichas de cliente y de proveedor para que acepten varios dias de pago (en los clientes se desactiva para acana), ademas de retocar la lógica de generacion de los recibos asociados a las facturas.
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@369 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
709430d667
commit
38785086a1
@ -119,10 +119,10 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Windows, uNumUtils, Controls, cxControls, DB, uEditorRegistryUtils, schFacturasClienteClient_Intf,
|
Windows, uDateUtils, uNumUtils, Controls, cxControls, DB, uEditorRegistryUtils, schFacturasClienteClient_Intf,
|
||||||
uBizContactos, uIEditorFacturasCliente, uIEditorFacturaCliente, uFactuGES_App,
|
uBizContactos, uIEditorFacturasCliente, uIEditorFacturaCliente, uFactuGES_App,
|
||||||
uDataModuleFacturasCliente, uBizDetallesFacturaCliente, uControllerDetallesBase,
|
uDataModuleFacturasCliente, uBizDetallesFacturaCliente, uControllerDetallesBase,
|
||||||
uDataModuleUsuarios, uDAInterfaces, uDataTableUtils, uDateUtils,
|
uDataModuleUsuarios, uDAInterfaces, uDataTableUtils,
|
||||||
uAlbaranesClienteController, schAlbaranesClienteClient_Intf, uROTypes, uDetallesAlbaranClienteController,
|
uAlbaranesClienteController, schAlbaranesClienteClient_Intf, uROTypes, uDetallesAlbaranClienteController,
|
||||||
uBizDetallesAlbaranCliente, uFacturasClienteReportController,
|
uBizDetallesAlbaranCliente, uFacturasClienteReportController,
|
||||||
// uBizPedidosCliente, uPedidosClienteController, uBizDetallesPedidoCliente,
|
// uBizPedidosCliente, uPedidosClienteController, uBizDetallesPedidoCliente,
|
||||||
@ -656,7 +656,8 @@ begin
|
|||||||
|
|
||||||
//De esta forma obligaremos siempre a tener un recibo asociado a la factura,
|
//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
|
//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
|
begin
|
||||||
try
|
try
|
||||||
AFormaPago := Buscar(AFactura.ID_FORMA_PAGO);
|
AFormaPago := Buscar(AFactura.ID_FORMA_PAGO);
|
||||||
@ -669,6 +670,7 @@ begin
|
|||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
if (AFactura.IGNORAR_CONTABILIDAD = 0) and ((AFactura.Cliente.SubCuentas.ID < 1)
|
if (AFactura.IGNORAR_CONTABILIDAD = 0) and ((AFactura.Cliente.SubCuentas.ID < 1)
|
||||||
//REPASAR
|
//REPASAR
|
||||||
@ -1159,56 +1161,66 @@ begin
|
|||||||
|
|
||||||
//Se cambia la lógica a peticion de acana, en el caso de meter una fecha de vencimiento,
|
//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
|
//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
|
With AFormaPago.Plazos.DataTable do
|
||||||
begin
|
begin
|
||||||
i := 1;
|
i := 1;
|
||||||
First;
|
First;
|
||||||
repeat
|
repeat
|
||||||
ARecibos := ARecibosClienteController.Nuevo;
|
//SOLO PARA ACANA (Leer comentario anterior
|
||||||
ARecibos.Edit;
|
if (AFormaPago.Plazos.RecordCount > 0)
|
||||||
ARecibos.ID_FACTURA := AFactura.ID;
|
or (AFactura.FECHA_VENCIMIENTO <> 0) then
|
||||||
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
|
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.FECHA_VENCIMIENTO := AFactura.FECHA_VENCIMIENTO;
|
||||||
ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL;
|
ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
|
||||||
AFechaVencimiento := AFactura.FECHA_FACTURA + AFormaPago.Plazos.NUM_DIAS;
|
|
||||||
ADiasMas := 0;
|
|
||||||
if (AFactura.Cliente.VENCIMIENTO_FACTURAS <> 0) then
|
|
||||||
begin
|
begin
|
||||||
ADiaVencimiento := DayOf(AFechaVencimiento);
|
AFechaVencimiento := AFactura.FECHA_FACTURA + AFormaPago.Plazos.NUM_DIAS;
|
||||||
while (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS) do
|
ADiasMas := 0;
|
||||||
begin
|
if (AFactura.Cliente.VENCIMIENTO_FACTURAS_1 <> 0)
|
||||||
if ADiaVencimiento = DaysInMonth(AFechaVencimiento) then
|
or (AFactura.Cliente.VENCIMIENTO_FACTURAS_2 <> 0)
|
||||||
ADiaVencimiento := 1
|
or (AFactura.Cliente.VENCIMIENTO_FACTURAS_3 <> 0) then
|
||||||
else
|
begin
|
||||||
Inc(ADiaVencimiento);
|
ADiaVencimiento := DayOf(AFechaVencimiento);
|
||||||
Inc(ADiasMas);
|
while (ADiaVencimiento <> AFactura.Cliente.VENCIMIENTO_FACTURAS_1)
|
||||||
end;
|
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;
|
end;
|
||||||
|
|
||||||
AFechaVencimiento := IncDay(AFechaVencimiento, ADiasMas);
|
ARecibos.DESCRIPCION := 'RECIBO ' + ARecibos.REFERENCIA + ' - ' + CifraToLetras(ARecibos.IMPORTE);
|
||||||
ARecibos.FECHA_VENCIMIENTO := AFechaVencimiento;
|
ARecibosClienteController.Guardar(ARecibos);
|
||||||
ARecibos.IMPORTE := AFactura.IMPORTE_TOTAL * (AFormaPago.Plazos.PORCENTAJE / 100);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ARecibos.DESCRIPCION := 'RECIBO ' + ARecibos.REFERENCIA + ' - ' + CifraToLetras(ARecibos.IMPORTE);
|
|
||||||
ARecibosClienteController.Guardar(ARecibos);
|
|
||||||
Inc(i);
|
Inc(i);
|
||||||
Next;
|
Next;
|
||||||
until (eof);
|
until (eof);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user