poArreglo de recibos para que funcionen de forma autónoma sin necesidad de Facturas de (Segunda parte)
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@139 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
4ceb429099
commit
ecdea708af
@ -3355,7 +3355,7 @@ SELECT RECIBOS_CLIENTE.ID,
|
|||||||
COALESCE(RECIBOS_CLIENTE.IMPORTE, 0) + COALESCE(RECIBOS_CLIENTE.OTROS_GASTOS, 0) + COALESCE(V_REC_CLI_COMPENSADOS.IMPORTE_TOTAL_COMPENSADO, 0),
|
COALESCE(RECIBOS_CLIENTE.IMPORTE, 0) + COALESCE(RECIBOS_CLIENTE.OTROS_GASTOS, 0) + COALESCE(V_REC_CLI_COMPENSADOS.IMPORTE_TOTAL_COMPENSADO, 0),
|
||||||
|
|
||||||
FACTURAS_CLIENTE.FECHA_FACTURA, FORMAS_PAGO.DESCRIPCION, FACTURAS_CLIENTE.IMPORTE_TOTAL,
|
FACTURAS_CLIENTE.FECHA_FACTURA, FORMAS_PAGO.DESCRIPCION, FACTURAS_CLIENTE.IMPORTE_TOTAL,
|
||||||
FACTURAS_CLIENTE.ID_EMPRESA,
|
RECIBOS_CLIENTE.ID_EMPRESA,
|
||||||
|
|
||||||
CONTACTOS.ID as ID_CLIENTE, CONTACTOS.NOMBRE, CONTACTOS.NIF_CIF, CONTACTOS_DATOS_BANCO.ENTIDAD,
|
CONTACTOS.ID as ID_CLIENTE, CONTACTOS.NOMBRE, CONTACTOS.NIF_CIF, CONTACTOS_DATOS_BANCO.ENTIDAD,
|
||||||
CONTACTOS_DATOS_BANCO.SUCURSAL, CONTACTOS_DATOS_BANCO.DC, CONTACTOS_DATOS_BANCO.CUENTA,
|
CONTACTOS_DATOS_BANCO.SUCURSAL, CONTACTOS_DATOS_BANCO.DC, CONTACTOS_DATOS_BANCO.CUENTA,
|
||||||
|
|||||||
@ -714,36 +714,52 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
ANuevoReciboCliente := NIL;
|
if ARecibosCliente.EsNuevo then
|
||||||
ImporteRestante := 0;
|
|
||||||
|
|
||||||
if ValidarReciboCliente(ARecibosCliente) then
|
|
||||||
begin
|
begin
|
||||||
|
if ValidarReciboCliente(ARecibosCliente) then
|
||||||
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
//Si el importe ha cambiado se debe hacer un recibo nuevo con el importe restante
|
|
||||||
if ImporteTotalModificado(ARecibosCliente, ImporteRestante) then
|
|
||||||
begin
|
|
||||||
ANuevoReciboCliente := Duplicar(ARecibosCliente);
|
|
||||||
ANuevoReciboCliente.Edit;
|
|
||||||
ANuevoReciboCliente.REFERENCIA := DarNuevaReferencia(ARecibosCliente.ID_FACTURA, ARecibosCliente.REFERENCIA);
|
|
||||||
ANuevoReciboCliente.IMPORTE := ImporteRestante;
|
|
||||||
ANuevoReciboCliente.DESCRIPCION := 'RECIBO ' + ANuevoReciboCliente.REFERENCIA + ' - ' + CifraToLetras(ImporteRestante);
|
|
||||||
ANuevoReciboCliente.Post;
|
|
||||||
end;
|
|
||||||
|
|
||||||
//Primero debemos hacer el ApplyUpdates del recibo inicial por si fallase
|
|
||||||
//Así no se haría el nuevo
|
|
||||||
ARecibosCliente.DataTable.ApplyUpdates;
|
ARecibosCliente.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
if Assigned(ANuevoReciboCliente) then
|
|
||||||
ANuevoReciboCliente.DataTable.ApplyUpdates;
|
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
finally
|
finally
|
||||||
ANuevoReciboCliente := NIL;
|
|
||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ANuevoReciboCliente := NIL;
|
||||||
|
ImporteRestante := 0;
|
||||||
|
|
||||||
|
if ValidarReciboCliente(ARecibosCliente) then
|
||||||
|
begin
|
||||||
|
ShowHourglassCursor;
|
||||||
|
try
|
||||||
|
//Si el importe ha cambiado se debe hacer un recibo nuevo con el importe restante
|
||||||
|
if ImporteTotalModificado(ARecibosCliente, ImporteRestante) then
|
||||||
|
begin
|
||||||
|
ANuevoReciboCliente := Duplicar(ARecibosCliente);
|
||||||
|
ANuevoReciboCliente.Edit;
|
||||||
|
ANuevoReciboCliente.REFERENCIA := DarNuevaReferencia(ARecibosCliente.ID_FACTURA, ARecibosCliente.REFERENCIA);
|
||||||
|
ANuevoReciboCliente.IMPORTE := ImporteRestante;
|
||||||
|
ANuevoReciboCliente.DESCRIPCION := 'RECIBO ' + ANuevoReciboCliente.REFERENCIA + ' - ' + CifraToLetras(ImporteRestante);
|
||||||
|
ANuevoReciboCliente.Post;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//Primero debemos hacer el ApplyUpdates del recibo inicial por si fallase
|
||||||
|
//Así no se haría el nuevo
|
||||||
|
ARecibosCliente.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
|
if Assigned(ANuevoReciboCliente) then
|
||||||
|
ANuevoReciboCliente.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
finally
|
||||||
|
ANuevoReciboCliente := NIL;
|
||||||
|
HideHourglassCursor;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ implementation
|
|||||||
{ TBizRecibosCliente }
|
{ TBizRecibosCliente }
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, uDataTableUtils, schContactosClient_Intf;
|
SysUtils, uDataTableUtils, schContactosClient_Intf, uFactuGES_App, uBizEmpresasTiendas;
|
||||||
|
|
||||||
function TBizRecibosCliente.GetCliente: IBizCliente;
|
function TBizRecibosCliente.GetCliente: IBizCliente;
|
||||||
begin
|
begin
|
||||||
@ -200,6 +200,10 @@ begin
|
|||||||
FECHA_EMISION := Date;
|
FECHA_EMISION := Date;
|
||||||
IMPORTE := 0;
|
IMPORTE := 0;
|
||||||
OTROS_GASTOS := 0;
|
OTROS_GASTOS := 0;
|
||||||
|
ID_EMPRESA := AppFactuGES.EmpresaActiva.ID;
|
||||||
|
USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
||||||
|
ID_TIENDA := CTE_ID_TODAS;
|
||||||
|
// TIENDA := CTE_TODAS;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBizRecibosCliente.OnNewRecord(Sender: TDADataTable);
|
procedure TBizRecibosCliente.OnNewRecord(Sender: TDADataTable);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user