Beispiel #1
0
 public function agregarDetalleFactura($nroSerie, $nroFact, $idProducto, $cantidad, $Precio)
 {
     $resultado = array('valor' => 1, 'message' => 'Su solicitud ha sido procesada correctamente.');
     $Detalle = new Detallefactura();
     $Detalle->nroSerie = $nroSerie;
     $Detalle->nroFact = $nroFact;
     $Detalle->idProducto = $idProducto;
     $Detalle->cantidad = $cantidad;
     $Detalle->precio = $Precio;
     $Detalle->save();
     return $resultado;
 }
Beispiel #2
0
 public function actionAjaxAgregarDetalleFactura()
 {
     $json = $_POST['json'];
     $array = json_decode($json);
     $nroSerie = $_POST['nroSerie'];
     $nroFact = $_POST['nroFact'];
     $nro_documento = $_POST['nroFact'];
     $tipo_documento = "1";
     $tipo = "S";
     foreach ($array as $obj) {
         $idProducto = $obj->Codigo;
         $cantidad = $obj->Cantidad;
         $Precio = $obj->Precio;
         $Total = $obj->Importe;
         Detallefactura::model()->agregarDetalleFactura($nroSerie, $nroFact, $idProducto, $cantidad, $Precio);
         Inventario::model()->agregarInventario($tipo_documento, $nroSerie, $nro_documento, $tipo, $idProducto, $cantidad, $Precio, $Total);
     }
     //$array_string=mysql_escape_string(serialize($array));
     //header('Content-Type: application/json; charset="UTF-8"');
     Util::renderJSON(array('success' => true));
 }