Ejemplo n.º 1
0
 public function actionScore()
 {
     $configSoftware = ConfigSoftware::model()->find();
     if (!empty($_POST)) {
         $configSoftware->score = Util::input($_POST['score']);
         $configSoftware->save();
     }
     $this->render('//Support/Score', array('configSoftware' => $configSoftware));
 }
Ejemplo n.º 2
0
$d = $arr_day[2];
$m = $arr_day[1];
$y = $arr_day[0];
$h = $arr_time[0];
$i = $arr_time[1];
$configSoftware = ConfigSoftware::model()->find();
$h = $h + $configSoftware->count_hour;
$date_time1 = date("{$d}/{$m}/{$y}");
$date_time2 = date("{$h}:{$i}");
$date_time = "{$date_time1} {$date_time2}";
// header
$td_logo = '';
if ($org->org_logo_show_on_bill == 'yes') {
    $td_logo = "\r\n\t\t<td width='80px' rowspan='6'>\r\n\t\t\t<img src='upload/{$org->org_logo}' width='60px' />\r\n\t\t</td>\r\n\t";
}
$configSoftware = ConfigSoftware::model()->find();
$bill_send_title = $configSoftware->bill_send_title;
$bill_sale_title = $configSoftware->bill_sale_title;
$headerText = $bill_send_title;
if ($billType == "sale") {
    $headerText = $bill_sale_title;
}
$header = "\r\n\t<table width='100%'>\r\n\t\t<tr valign='top'>\r\n\t\t\t{$td_logo}\r\n        \r\n\t\t\t<td align='center'>\r\n\t\t\t\t<div class='header-text bold'>\r\n\t\t\t\t\t{$headerText}\r\n\t\t\t\t</div>\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <td align='center'>\r\n\t\t\t    <div class='header-text'>\r\n\t\t\t    \t{$org->org_name} {$org->org_name_eng}\r\n\t\t\t    </div>\r\n            </td>\r\n        <tr>\r\n            <td align='center'>\r\n\t\t\t    <div class='header-text'>\r\n\t\t\t    \tเลขประจำตัวผู้เสียภาษี: {$org->org_tax_code} เบอร์โทร; {$org->org_tel}\r\n\t\t\t    </div>\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <td align='center'>\r\n\t\t\t    <div class='header-text'>\r\n\t\t\t    \t{$org->org_address_1} {$org->org_address_2}\r\n\t\t\t    </div>\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <td align='center'>\r\n\t\t\t    <div class='header-text'>\r\n\t\t\t    \t{$org->org_address_3} {$org->org_address_4}\r\n\t\t\t    </div>\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <td align='center'>\r\n\t\t\t    <div class='header-text'>\r\n\t\t\t    \tวันที่: {$date_time} เลขที่บิล: {$billSaleId}\r\n\t\t\t    </div>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\t\r\n    ";
// to member
if (!empty($member)) {
    $header .= "\r\n    <div class='row'>\r\n        <span><strong>ลูกค้า:</strong> {$member->member_name}</span>\r\n        <span>&nbsp;&nbsp;&nbsp;</span>\r\n        <span><strong>เบอร์โทร:</strong> {$member->member_tel}</span>\r\n    </div>\r\n    <div class='row'>\r\n        <span><strong>เลขประจำตัวผู้เสียภาษี:</strong> </span>\r\n        <span>{$member->tax_code}</span>\r\n    </div>\r\n    <div class='row'><strong>ที่อยู่:</strong> {$member->member_address}</div>\r\n    ";
}
if (!empty($billSale->customer_name)) {
    $header .= "\r\n    <div class='row'>\r\n        <span><strong>ลูกค้า:</strong> {$billSale->customer_name}</span>\r\n        <span>&nbsp;&nbsp;&nbsp;</span>\r\n        <span><strong>เบอร์โทร:</strong> {$billSale->customer_tel}</span>\r\n    </div>\r\n    <div class='row'>\r\n        <span><strong>เลขประจำตัวผู้เสียภาษี:</strong> </span>\r\n        <span>{$billSale->customer_tax}</span>\r\n    </div>\r\n    <div class='row'><strong>ที่อยู่:</strong> {$billSale->customer_address}</div>\r\n    ";
}
// content
Ejemplo n.º 3
0
 public function actionAlertStock($print = false)
 {
     $configSoftware = ConfigSoftware::model()->find();
     $products = Product::model()->findAll(array('condition' => 'product_quantity <= :qty', 'order' => 'product_quantity', 'params' => array('qty' => $configSoftware->alert_min_stock)));
     if (!$print) {
         $this->render('//Basic/AlertStock', array('products' => $products, 'n' => 1, 'print' => $print));
     } else {
         $this->renderPartial('//Basic/AlertStock', array('products' => $products, 'n' => 1, 'print' => $print));
     }
 }
Ejemplo n.º 4
0
 public function actionConfigSerialPort()
 {
     $this->checkLogin();
     $configSoftware = ConfigSoftware::model()->find();
     if (!empty($_POST)) {
         $configSoftware->serial_port = Util::input($_POST['serial_port']);
         if ($configSoftware->save()) {
             Yii::app()->user->setFlash('message', 'บันทึกรายการแล้ว');
             $this->redirect(array('ConfigSerialPort'));
         }
     }
     $this->render('//Config/ConfigSerialPort', array('configSoftware' => $configSoftware));
 }
Ejemplo n.º 5
0
 public function actionOpenDrawCash()
 {
     $configSoftware = ConfigSoftware::model()->find();
     $serial = new Serial();
     $serial->deviceSet($configSoftware->serial_port);
     $serial->deviceOpen();
     $serial->sendMessage("Open");
     $read = $serial->readPort();
     $serial->deviceClose();
     $serial->confBaudRate(2400);
 }
 function actionSaleSumPerMember()
 {
     $y = date('Y');
     if (!empty($_POST)) {
         $y = $_POST['y'];
     }
     $yearList = array();
     $yearStart = date('Y');
     for ($i = $yearStart - 5; $i <= $yearStart; $i++) {
         $yearList[$i] = $i;
     }
     $members = Member::model()->findAll(array('order' => 'member_id DESC'));
     $billSale = new BillSale();
     $configSoftware = ConfigSoftware::model()->find();
     $this->render('//Report/ReportSaleSumPerMember', array('members' => $members, 'n' => 1, 'billSale' => $billSale, 'configSoftware' => $configSoftware, 'y' => $y, 'yearList' => $yearList));
 }
 public function actionConfigSoftwareInfo()
 {
     $configSoftware = ConfigSoftware::model()->find();
     echo CJSON::encode($configSoftware);
 }
Ejemplo n.º 8
0
 public function actionBillTaxLittle($bill_sale_id)
 {
     $bill_sale_id = (int) $bill_sale_id;
     $billSale = BillSale::model()->findByPk($bill_sale_id);
     $billSaleDetails = BillSaleDetail::model()->findAllByAttributes(array('bill_id' => $bill_sale_id));
     $billConfig = BillConfig::model()->find();
     $configSoftware = ConfigSoftware::model()->find();
     $this->renderPartial('//Report/BillTaxLittle', array('billSale' => $billSale, 'billSaleDetails' => $billSaleDetails, 'billConfig' => $billConfig, 'configSoftware' => $configSoftware));
 }
 public function actionConfigSale()
 {
     $this->checkLogin();
     $configSoftware = ConfigSoftware::model()->find();
     if (!empty($_POST)) {
         $sale_can_edit_price = 'no';
         $sale_can_add_sub_price = 'no';
         $sale_out_of_stock = 'no';
         $sale_can_edit_price = @Util::input($_POST['ConfigSoftware']['sale_can_edit_price']);
         $sale_can_add_sub_price = @Util::input($_POST['ConfigSoftware']['sale_can_add_sub_price']);
         $sale_out_of_stock = @Util::input($_POST['ConfigSoftware']['sale_out_of_stock']);
         $configSoftware->sale_can_edit_price = $sale_can_edit_price;
         $configSoftware->sale_can_add_sub_price = $sale_can_add_sub_price;
         $configSoftware->sale_out_of_stock = $sale_out_of_stock;
         if ($configSoftware->save()) {
             Yii::app()->user->setFlash('message', 'บันทึกรายการแล้ว');
             $this->redirect(array('ConfigSale'));
         }
     }
     $this->render('//Config/ConfigSale', array('configSoftware' => $configSoftware));
 }