コード例 #1
0
 public function postCreateOrder()
 {
     $values = Request::all();
     $serviceOrder = new fil_service_order();
     $serviceOrder->ser_id = $this->createServiceOrderId();
     $serviceOrder->ser_discount_month = $values['ser_discount_month'];
     $serviceOrder->ser_outlay_total = $values['ser_outlay_total'];
     $serviceOrder->ser_iva = $values['ser_iva'];
     $serviceOrder->ser_duration = $values['ser_duration'];
     $serviceOrder->ser_start_date = $values['ser_start_date'];
     $serviceOrder->ser_end_date = $values['ser_end_date'];
     $serviceOrder->ser_fk_customer = $values['ser_fk_customer'];
     $serviceOrder->ser_auth_admin = 0;
     $serviceOrder->ser_auth_production = 0;
     $serviceOrder->ser_auth_sales = 0;
     $serviceOrder->ser_observations_production = '';
     $serviceOrder->ser_observations_admin = '';
     $serviceOrder->ser_observations_sales = '';
     if (!$serviceOrder->save()) {
         return Response::json(array('success' => false, 'data' => 'Error al guardar la orden de servicio'));
     }
     $customer = fil_customer::find($values['ser_fk_customer']);
     $customer->cus_status = 'activo';
     if (!$customer->save()) {
         return Response::json(array('success' => false, 'data' => 'Error al guardar el estado de cliente'));
     }
     $this->createDetails($serviceOrder, json_decode(json_encode($values['detail_product'])));
     $this->createPayments($serviceOrder, $values['pay_amount_cash'], $values['pay_amount_kind'], $values['pay_number_payments'], $values['payment_date']);
     return Response::json(array('success' => true, 'data' => 'Orden de Servicio creada con éxito'));
 }
コード例 #2
0
 public function postChangeEmployee()
 {
     $values = Request::all();
     foreach ($values['customers'] as $value) {
         $customer = fil_customer::find($value);
         $customer->cus_fk_employee = $values['id'];
         $customer->save();
     }
     return Response::json(array('success' => true, 'data' => 'Clientes actualizados con exíto'));
 }