コード例 #1
0
 function upload_single_file_payment($id)
 {
     $this->autoRender = false;
     if ($this->data['UploadPayment']['deposit'] == 'Yes') {
         App::import("Model", "UploadPayment");
         $upload = new UploadPayment();
         $upload_data = $upload->find('first', array('conditions' => array('UploadPayment.ref_id' => $id)));
         if (empty($upload_data)) {
             App::import("Model", "PurchaseOrderManager.GeneralSetting");
             $generalsetting_model = new GeneralSetting();
             $deposit = $generalsetting_model->find('first', array('conditions' => array('GeneralSetting.type' => 'deposit_payment')));
             $total_for_quote = $this->findTotalAmountQuote($id);
             $minimum_payment = number_format($deposit['GeneralSetting']['value'] / 100 * $total_for_quote, 2);
             $total_amount_from_form = number_format($this->data['UploadPayment']['amount'], 2);
             if ($total_amount_from_form < $minimum_payment) {
                 $m = "Please put minimum amount for payment";
                 die(json_encode($m));
             }
         }
     }
     if (!empty($this->request->data['UploadPayment']['file'])) {
         $this->uploadFilePayment();
     }
     App::import("Model", "UploadPayment");
     $upload = new UploadPayment();
     $upload->save($this->data);
     $m = "Saved";
     die(json_encode($m));
 }
コード例 #2
0
 public function deposit_payment_add()
 {
     $this->layoutOpt['left_nav'] = "general-left-nav";
     $this->layoutOpt['left_nav_selected'] = "list_general";
     if ($this->isAjax) {
         $this->layoutOpt['layout'] = 'ajax';
     } else {
         $this->layoutOpt['layout'] = 'left_bar_template';
     }
     $this->side_bar = "admin";
     $this->set("side_bar", $this->side_bar);
     App::import('Model', 'PurchaseOrderManager.GeneralSetting');
     $general_model = new GeneralSetting();
     $general_model->save($this->request->data);
     $this->redirect(array('controller' => 'purchase_orders', 'action' => 'general_setting_list'));
 }
コード例 #3
0
 function getDefaultLocaltionName($id = null)
 {
     App::import('Model', 'PurchaseOrderManager.GeneralSetting');
     $gs = new GeneralSetting();
     $gs_data = $gs->find("first", array('conditions' => array('GeneralSetting.id' => $id)));
     return $gs_data['GeneralSetting']['name'];
 }
コード例 #4
0
 public function getProductionTime($id = null)
 {
     App::uses("GeneralSetting", "PurchaseOrderManager.Model");
     $general_setting = new GeneralSetting();
     $data = $general_setting->find("first", array('conditions' => array('GeneralSetting.id' => $id)));
     $value = $data['GeneralSetting']['value'] / 100;
     return $value;
 }