Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $facture = Facture::create($request->all());
     $facture->projects()->sync($request->projectList);
     Session::flash('flash_message', 'Facture added!');
     return redirect('admin/facture');
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $profil = Livraison::with('devis')->findOrfail($request->input('id'));
     foreach ($profil->modules as $key => $value) {
         $produit_id = $value->pivot->produit_id;
     }
     $produit = Produit::findOrFail($produit_id);
     $produits = $produit->modules;
     $modules = $profil->modules;
     $da = $request->input('da');
     $dv_prefix = $produit->prefix_produit;
     $dv_suffix = $produit->suffix_produit;
     $facture_number = DB::table('factures')->select('num_facture')->where('num_facture', 'like', '%FACT-' . $dv_prefix . '%')->orderBy('id', 'desc')->first();
     var_dump($facture_number);
     if (empty($facture_number)) {
         $num_facture = 'FACT-' . $dv_prefix . '-' . date('y') . date('m') . $dv_suffix;
     } else {
         foreach ($facture_number as $fctvalue) {
             $last_fct_number = $fctvalue;
         }
         $lg = strlen('FACT-' . $dv_prefix . '-') + 4;
         $inc_fct_number = substr($last_fct_number, $lg) + 1;
         $num_facture = 'FACT-' . $dv_prefix . '-' . date('y') . date('m') . $inc_fct_number;
     }
     $societedata = DB::table('societedatas')->select('id')->orderBy('created_at', 'desc')->first();
     $data = ['num_facture' => $num_facture, 'livraison_id' => $profil->id, 'devis_id' => $profil->devis_id, 'num_da' => $da, 'livraison_id' => $profil->id, 'suivi_facture' => $profil->suivi_bl, 'destinataire' => $profil->destinataire, 'adresse_dest' => $profil->adresse_dest, 'pays_dest' => $profil->pays_dest, 'ville_dest' => $profil->ville_dest, 'tel_dest' => $profil->tel_dest, 'ref_dest' => $profil->ref_dest, 'num_cmd' => $profil->num_cmd, 'livraison_modal' => $num_facture, 'contact_dest' => $profil->contact_dest, 'societedata_id' => $societedata->id, 'fax_dest' => $profil->fax_dest, 'email_dest' => $profil->email_dest, 'url_dest' => $profil->url_dest, 'nom_produit' => $profil->nom_produit, 'echeance' => $profil->echeance, 'total_ht' => $profil->total_ht, 'total_anpme' => $profil->total_anpme, 'total_part' => $profil->total_part, 'gescom_id' => $profil->gescom_id, 'contact_id' => $profil->contact_id, 'societe_id' => $profil->societe_id];
     $facture = Facture::create($data);
     $modules = $profil->modules;
     foreach ($modules as $value) {
         $facture->modules()->attach($value->pivot->module_id, ['quantite' => $value->pivot->quantite, 'produit_id' => $value->pivot->produit_id, 'service_duree' => $value->pivot->service_duree]);
     }
     $id = $facture->id;
     return redirect()->route('facture.show', $id);
 }
Ejemplo n.º 3
0
*/
/***********************************************************************************/
/***********************************************************************************/
Route::group(['middleware' => ['admin']], function () {
    Route::resource('admin/process', 'Admin\\ProcessController');
    Route::resource('admin/process', 'Admin\\ProcessController');
    Route::resource('admin/task', 'Admin\\TaskController');
    // Route::resource('admin/pivotextrafield', 'Admin\\PivotExtraFieldController');
    Route::resource('admin/process', 'Admin\\ProcessController');
});
//api for CRUD & vue
Route::get('api/facture/', function () {
    return Facture::orderBy('id', 'desc')->get();
});
Route::post('api/facture/create', function () {
    return Facture::create(Request::all());
});
Route::put('api/facture/{facture}', function (Facture $facture) {
    if ($facture->update(Request::all())) {
        return 'ok';
    }
});
Route::delete('api/facture/{facture}', function (Facture $facture) {
    // http://organit.app/api/table/1/factures
    $facture->delete();
});
Route::get('admin/generate_seeder', function (App\Table $table) {
    $schema = \DB::getDoctrineSchemaManager();
    $tables = $schema->listTables();
    foreach ($tables as $key => $table) {
        echo "/////";