コード例 #1
0
 public function imprimir_ordenes_indiv($idorden)
 {
     $orden_prov = new orden_prov();
     $orden = $orden_prov->get($idorden);
     $recibo_prov = new recibo_proveedor();
     $recibo = $recibo_prov->get_por_idorden($idorden);
     $valor = new valores();
     $valores = $valor->get_por_idorden($idorden);
     $factura_prov = new factura_proveedor();
     $pdf_doc = new fs_pdf();
     $cant_lineas_orden = count($orden);
     $lineas_total = 0;
     $cant_lineas = 25;
     $linea_actual = 0;
     $pagina = 1;
     $total_facturado = 0;
     $total_valor = 0;
     /////  Primer encabezado
     $pdf_doc->pdf->ezText("Página " . $pagina, 9, array('justification' => 'right'));
     $pdf_doc->pdf->ezText("<b>" . $this->empresa->nombre . "</b>", 10, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("Fecha: " . $orden->fecha . "                ", 9, array('justification' => 'right'));
     $pdf_doc->pdf->ezText("Orden de Pago Nº: " . $orden->idorden . "          ", 12, array('justification' => 'right'));
     $pdf_doc->pdf->ezText($this->empresa->direccion, 10, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText("<b>Órdenes de pago</b>", 16, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText("<b>Proveedor:  " . $orden->provorden . "</b>", 10, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("<b> Concepto:  " . $orden->conceptoorden . "</b>", 10, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText("<b>Facturas</b>", 12, array('justification' => 'left'));
     $pdf_doc->new_table();
     $pdf_doc->add_table_header(array('fecha' => '<b>Fecha Fact.</b>', 'facdoc' => '<b>Documento</b>', 'factnum' => '<b>Número</b>', 'recargo' => '<b>Recargo</b>', 'factimp' => '<b>Importe Fact.</b>', 'total' => '<b>Total</b>'));
     $sub_t = 0;
     foreach ($recibo as $p) {
         $factura = $factura_prov->get_by_codigo($p->codigo);
         if (substr($p->factprov, 0, 1) == 'C' || substr($p->factprov, 0, 1) == 'Q') {
             $sub_t = $p->importe * -1;
         } else {
             $sub_t = $p->importe;
         }
         if (substr($p->factprov, 0, 1) == 'B') {
             $comp_doc = 'FACTURA B';
         }
         if (substr($p->factprov, 0, 1) == 'F') {
             $comp_doc = 'FACTURA C';
         }
         if (substr($p->factprov, 0, 1) == 'T') {
             $comp_doc = 'TICKET FACTURA';
         }
         if (substr($p->factprov, 0, 1) == 'Q') {
             $comp_doc = 'TICKET CRÉDITO';
         }
         if (substr($p->factprov, 0, 1) == 'C') {
             $comp_doc = 'NOTA DE CRÉDITO';
         }
         if (substr($p->factprov, 0, 1) == 'D') {
             $comp_doc = 'NOTA DE DÉBITO';
         }
         $numcompr = substr($p->factprov, 2);
         $pdf_doc->add_table_row(array('fecha' => $p->fecha, 'facdoc' => $comp_doc, 'factnum' => $numcompr, 'recargo' => $p->recargo, 'factimp' => $sub_t, 'total' => $sub_t + $p->recargo, 'valor' => $factura->observaciones, 'importe' => $sub_t));
         $total_facturado += $sub_t + $p->recargo;
     }
     $pdf_doc->save_table(array('cols' => array('campo1' => array('justification' => 'left'), 'dato1' => array('justification' => 'left'), 'campo2' => array('justification' => 'left'), 'dato2' => array('justification' => 'left')), 'showLines' => 3, 'width' => 520, 'shaded' => 1));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText("<b>Valores Entregados</b>", 12, array('justification' => 'left'));
     $pdf_doc->new_table();
     $pdf_doc->add_table_header(array('fecha' => '<b>Fecha </b>', 'banco' => '<b>Banco</b>', 'numero' => '<b>Número</b>', 'importe' => '<b>Importe</b>'));
     foreach ($valores as $p) {
         $pdf_doc->add_table_row(array('fecha' => $p->fecha, 'banco' => $p->banco, 'numero' => $p->numero, 'importe' => $p->importe));
         $total_valor += $p->importe;
     }
     $pdf_doc->save_table(array('cols' => array('campo1' => array('justification' => 'left'), 'dato1' => array('justification' => 'left'), 'campo2' => array('justification' => 'left'), 'dato2' => array('justification' => 'left')), 'showLines' => 3, 'width' => 520, 'shaded' => 1));
     $pdf_doc->pdf->ezText("\n", 14);
     $pdf_doc->pdf->ezText("<b>Total Facturado:   " . $total_facturado . "</b>", 11, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 6);
     $pdf_doc->pdf->ezText("<b>Total Entregado:  " . $total_valor . "</b>", 11, array('justification' => 'left'));
     $pdf_doc->set_y(140);
     $pdf_doc->pdf->ezText('FIRMA :  _________________________________________________  DNI: _________________________', 8, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText('ACLARACIÓN :  _________________________________________________ ', 8, array('justification' => 'left'));
     $pdf_doc->pdf->ezText("\n", 10);
     $pdf_doc->pdf->ezText('DOMICILIO :  ___________________________________________________ ', 8, array('justification' => 'left'));
     $pdf_doc->show();
 }
コード例 #2
0
 public function delete()
 {
     /// desvinculamos la factura
     $fac = $this->get_factura();
     if ($fac) {
         if ($fac->idasiento == $this->idasiento) {
             $fac->idasiento = NULL;
             $fac->save();
         }
     }
     /////////  pone en "0" pagada en factura
     $fact_prov = new factura_proveedor();
     $recibo = new recibo_proveedor();
     $orden = new orden_prov();
     $valor = new valores();
     $data = $recibo->get_por_idasiento($this->idasiento);
     /////  pone en proceso la orden
     foreach ($data as $d) {
         //				$fact_data = $fact_prov->get($d->idfactura);
         //				$fact_data->pagada = 0;
         //				$fact_data->save();
         $idorden = $d->idorden;
         $orden->cambio_estado($idorden, 'Proceso');
         /// pone idasiento en recibos
         $recibo->guardar_asiento_idorden($idorden, NULL);
         /// pone idasiento en valores
         $valor->guardar_asiento_idorden($idorden, NULL);
     }
     ///////////////////////////////////////////
     /////////elimina los recibos según el idasiento
     //		if(!$recibo->delete_recibo_idasiento($this->idasiento))  $this->new_error_msg("Error - No se borraron los recibos");
     //////// elimina la orden según el idasiento
     //		$orden->cambio_estado($orden->idorden,'Proceso');
     //		if(!$orden->delete_orden_idasiento($this->idasiento)) $this->new_error_msg("Error - No se borraron las ordenes");
     /// eliminamos las partidas una a una para forzar la actualización de las subcuentas asociadas
     foreach ($this->get_partidas() as $p) {
         $p->delete();
     }
     return $this->db->exec("DELETE FROM " . $this->table_name . " WHERE idasiento = " . $this->var2str($this->idasiento) . ";");
 }