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),
|
||||
|
||||
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_DATOS_BANCO.SUCURSAL, CONTACTOS_DATOS_BANCO.DC, CONTACTOS_DATOS_BANCO.CUENTA,
|
||||
|
||||
@ -714,36 +714,52 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
ANuevoReciboCliente := NIL;
|
||||
ImporteRestante := 0;
|
||||
|
||||
if ValidarReciboCliente(ARecibosCliente) then
|
||||
if ARecibosCliente.EsNuevo then
|
||||
begin
|
||||
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
|
||||
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;
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ implementation
|
||||
{ TBizRecibosCliente }
|
||||
|
||||
uses
|
||||
SysUtils, uDataTableUtils, schContactosClient_Intf;
|
||||
SysUtils, uDataTableUtils, schContactosClient_Intf, uFactuGES_App, uBizEmpresasTiendas;
|
||||
|
||||
function TBizRecibosCliente.GetCliente: IBizCliente;
|
||||
begin
|
||||
@ -200,6 +200,10 @@ begin
|
||||
FECHA_EMISION := Date;
|
||||
IMPORTE := 0;
|
||||
OTROS_GASTOS := 0;
|
||||
ID_EMPRESA := AppFactuGES.EmpresaActiva.ID;
|
||||
USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
||||
ID_TIENDA := CTE_ID_TODAS;
|
||||
// TIENDA := CTE_TODAS;
|
||||
end;
|
||||
|
||||
procedure TBizRecibosCliente.OnNewRecord(Sender: TDADataTable);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user