Skip to content

Commit

Permalink
republica_dominicana: fix a informes de estado de cuenta v3
Browse files Browse the repository at this point in the history
  • Loading branch information
joenilson committed Sep 21, 2019
1 parent a32e091 commit 63eb3aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
33 changes: 29 additions & 4 deletions controller/informe_estadocuenta.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public function listado_facturas($dias, $offset = 0)
$this->abonos_factura($valores['idfactura'],$valores);
$data[$key]=$valores;
}

$sql_total = "SELECT count(*) as total".
" FROM facturascli ".
" WHERE anulada = false and pagada = false and idfacturarect IS NULL ".$intervalo.$this->sql_aux.";";
Expand All @@ -179,10 +180,34 @@ private function abonos_factura($idfactura, &$valores)
if($this->tesoreria === true) {
$recibos = new recibo_cliente();
$recibos_factura = $recibos->all_from_factura($idfactura);
foreach($recibos_factura as $recibo) {
if($recibo->estado === 'Pagado') {
$valores['abono'] += $recibo->importe;
$valores['saldo'] -= $recibo->importe;
$this->recibos_factura($recibos_factura, $valores);
}

$factura = new factura_cliente();
if($factura->get($idfactura)) {
$factura_actual = $factura->get($idfactura);
$this->rectificativas_factura($factura_actual, $valores);
}
}

private function recibos_factura($recibos_factura, &$valores)
{
foreach($recibos_factura as $recibo) {
if($recibo->estado === 'Pagado') {
$valores['abono'] += $recibo->importe;
$valores['saldo'] -= $recibo->importe;
}
}
}

private function rectificativas_factura($factura, &$valores)
{
$rects = $factura->get_rectificativas();
if($rects) {
foreach($rects as $rect) {
if($rect->anulada === false) {
$valores['abono'] += ($rect->total*-1);
$valores['saldo'] -= ($rect->total*-1);
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions controller/ventas_factura_devolucion.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,6 @@ private function generar_asiento(&$factura)
if ($this->empresa->contintegrada) {
$asiento_factura = new asiento_factura();
$asiento_factura->generar_asiento_venta($factura);

foreach ($asiento_factura->errors as $err) {
$this->new_error_msg($err);
}

foreach ($asiento_factura->messages as $msg) {
$this->new_message($msg);
}
} else {
/// generamos las líneas de IVA de todas formas
$factura->get_lineas_iva();
Expand Down

0 comments on commit 63eb3aa

Please sign in to comment.