예제 #1
0
파일: Product.php 프로젝트: aloewens/vacan
 function Process_Sale($post_array)
 {
     require_once APPPATH . 'models/Sales_Model.php';
     $sales = new Sales_Model();
     $prodID = $this->db->insert_id();
     $ref = "Cargo Venta";
     $type = "Debito";
     // Consulta Valor Tipo Producto
     $this->db->select('Price');
     $this->db->from('productcatalog');
     $this->db->where('ProductCatalogID', $this->input->post('PrProductCatalogID'));
     $ret = $this->db->get()->result();
     $value = $ret[0]->Price;
     //log_message('error', 'Value = ' . $value);
     // Registro Cargo Venta
     $method = 1;
     $entity = "OpenLife";
     $comment = "Cargo Venta";
     $user = $this->session->userdata('user_id');
     $sales->RegisterCharge($prodID, $ref, $type, $value, $method, $entity, $comment, $user);
     return true;
 }
예제 #2
0
파일: Charge.php 프로젝트: aloewens/vacan
 function ValidBalance()
 {
     require_once APPPATH . 'models/Sales_Model.php';
     $sales = new Sales_Model();
     $ProdID = $this->input->post('ProductID');
     $balance = $sales->GetProductBalance($ProdID, $this->input->post('Value'), $this->input->post('ChargeType'));
     // Actualiza Saldo Producto
     if ($balance < 0) {
         $this->form_validation->set_message('ValidBalance', 'El Saldo del Producto ' . $ProdID . ' no puede quedar Negativo : ' . $balance);
         return false;
     }
     return true;
 }