Exemplo n.º 1
0
 protected function saveFinance($client, $sum, $number_of_waybill, $registry, $date_of_registry, $keyStek)
 {
     $finance = new Finance();
     $finance->client = $client;
     $finance->sum = $sum;
     $finance->number_of_waybill = $number_of_waybill;
     $finance->type_of_funding = "Первый платеж";
     //$finance->date_of_funding
     $finance->registry = $registry;
     $finance->date_of_registry = $date_of_registry;
     $finance->status = "К финансированию";
     if ($finance->save()) {
         foreach ($keyStek as $key) {
             $deliveryToFinance = new DeliveryToFinance();
             $deliveryToFinance->delivery_id = $key;
             $deliveryToFinance->finance_id = $finance->id;
             $deliveryToFinance->save();
         }
     }
 }
Exemplo n.º 2
0
 public function ClearTable()
 {
     DailyChargeCommission::Truncate();
     //ChargeCommission::Truncate();
     Bill::Truncate();
     //Repayment::Truncate();
     DeliveryToFinance::Truncate();
     //Finance::Truncate();
     $repayments = Repayment::OrderBy('date')->get();
     foreach ($repayments as $repayment) {
         $repayment->balance = $repayment->sum;
         $repayment->save();
     }
     return ['callback' => 'success', 'message' => 'Успешно', 'message_shot' => 'Таблицы очищены'];
 }