Ejemplo n.º 1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $empresa = Empresa::paginate(100)->lists('name', 'id');
     return view('admin.account_form')->with('empresas', $empresa);
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $centro_costo = CostCenter::findOrFail($id);
     $tipo = null;
     if ($centro_costo->isprodut) {
         $tipo = 1;
     } else {
         if ($centro_costo->isfixedasset) {
             $tipo = 2;
         } else {
             if ($centro_costo->is_expense) {
                 $tipo = 3;
             }
         }
     }
     $empresa = Empresa::paginate(1000)->lists('name', 'id');
     return view('admin/edit_centro_costo')->with('empresas', $empresa)->with('tipo', $tipo)->with('centro_costo', $centro_costo);
 }
 public function hechouka_Compra()
 {
     $empresas = Empresa::paginate(100);
     $directorio = Storage::disk('local');
     if ($directorio->exists('file.txt')) {
         $directorio->delete('file.txt');
     }
     foreach ($empresas as $item) {
         $fila = $item->id . "\t" . $item->name;
         Storage::disk('local')->append('file.txt', $fila);
     }
     // dd($array);
     dd("ok");
     //        $rango1=[1,2,3,5];
     //        $rango2=[4,7,8,9,10,11,13];
     //        $rango3=[4,7,8,9,10,13];
     if (\Session::has('id_empresa')) {
         $miscompras = Compras_Ventas::miscompras(\Session::get('id_empresa'))->get();
         $array_compras = json_decode($item);
         if ($array_compras != []) {
             $cont = 0;
             foreach ($miscompras as $item) {
                 while ($cont <= 15000) {
                     $tipo_registro = 2;
                     $ruc = $this->dividirCodigo($item->gov_code)[0];
                     $dv = $this->dividirCodigo($item->gov_code)[1];
                     $nombre = $item->name;
                     $tipo_documento = 1;
                     $timbrado = $item->invoice_code;
                     $numero_documento = $item->invoice_number;
                     $fecha = date_format($item->invoice_date, 'd/m/Y');
                     $mismontos = Comercial_invoice_iva::getMontoIva($item->id)->get();
                     $monto_10 = 0;
                     $iva_10 = 0;
                     $monto_5 = 0;
                     $iva_5 = 0;
                     $monto_e = 0;
                     foreach ($mismontos as $item1) {
                         if ($item1->vat_id == 1) {
                             $monto_10 = intval($item1->value);
                             $iva_10 = intval($monto_10 * 0.1);
                         } else {
                             if ($item1->vat_id == 2) {
                                 $monto_5 = intval($item1->value);
                                 $iva_5 = intval($monto_10 * 0.05);
                             } else {
                                 $monto_e = intval($item1->value);
                             }
                         }
                     }
                     $tipo_operacion = 0;
                     $condicion = 1;
                     if ($item->payment_condition == 1) {
                         $condicion = 2;
                     }
                     $cantidad_cuotas = $item->cuotas;
                     $detalle = $tipo_registro . "\t" . $ruc . "\t" . $dv . "\t" . $nombre . "\t" . $timbrado . "\t" . $tipo_documento . "\t" . $numero_documento . "\t" . $fecha . "\t" . $monto_10 . "\t" . $iva_10 . "\t" . $monto_5 . "\t" . $iva_5 . "\t" . $monto_e . "\t" . $tipo_operacion . "\t" . $condicion . "\t" . $cantidad_cuotas;
                     $cont++;
                 }
             }
         }
     }
 }