Exemplo n.º 1
0
 public function run()
 {
     $object = [["NUMERO_FACTURA" => "1000000001", "ID_PROVEEDOR" => "1", "ID_PRODUCTO" => "10", "CANTIDAD" => "1", "ID_UNIDAD_EMPAQUE" => "3", "PRECIO_TOTAL" => "12.000", "FECHA_COMPRA" => "2015-09-08"], ["NUMERO_FACTURA" => "1000000002", "ID_PROVEEDOR" => "2", "ID_PRODUCTO" => "20", "CANTIDAD" => "6", "ID_UNIDAD_EMPAQUE" => "2", "PRECIO_TOTAL" => "12.000", "FECHA_COMPRA" => "2015-09-09"], ["NUMERO_FACTURA" => "1000000003", "ID_PROVEEDOR" => "3", "ID_PRODUCTO" => "1", "CANTIDAD" => "15", "ID_UNIDAD_EMPAQUE" => "1", "PRECIO_TOTAL" => "12.000", "FECHA_COMPRA" => "2015-09-10"]];
     //DB::unprepared('ALTER TABLE '.$this->table.' AUTO_INCREMENT = 1');
     foreach ($object as $detail) {
         Compra::create($detail);
     }
 }
Exemplo n.º 2
0
 public function addAction()
 {
     // create a new model instance
     ////////////////////////////////////////////////////////////
     $xi = 0;
     if (Input::has('index')) {
         $xi = Input::get("index");
     }
     /////////////////////////////////////////////////////////////
     $Objnew = new Compra();
     if ($Objnew->isPosted()) {
         $new = Input::all();
         // attempt validation
         if ($Objnew->validate($xi, $new, 1)) {
             $object = Compra::create([Compra::$FieldsName[Compra::$FieldsOrderCreate['1']] => Input::get($this->FieldsCreate['1']['name'] . "0"), Compra::$FieldsName[Compra::$FieldsOrderCreate['2']] => Input::get($this->FieldsCreate['2']['name'] . $xi), Compra::$FieldsName[Compra::$FieldsOrderCreate['3']] => Input::get($this->FieldsCreate['3']['name'] . $xi), Compra::$FieldsName[Compra::$FieldsOrderCreate['4']] => Input::get($this->FieldsCreate['4']['name'] . $xi), Compra::$FieldsName[Compra::$FieldsOrderCreate['5']] => Input::get($this->FieldsCreate['5']['name'] . $xi), Compra::$FieldsName[Compra::$FieldsOrderCreate['6']] => Input::get($this->FieldsCreate['6']['name'] . $xi), Compra::$FieldsName[Compra::$FieldsOrderCreate['7']] => Input::get($this->FieldsCreate['7']['name'] . "0")]);
             return Response::json(['success' => true, 'iddelrow' => Input::get('index')]);
         } else {
             $this->errors = $Objnew->errors();
             $this->addrow = $this->addrowAction();
             return Response::json(['success' => false, 'error' => $this->errors->toArray()]);
         }
     }
     $this->addrow = $this->addrowAction();
     $object;
     $xi = 0;
     return View::make($this->routeAdd, ["row" => $this->addrow, "FieldsCreate" => $this->FieldsCreate, "module" => $this->module, "key" => $this->key]);
 }