function actionBillConfigIndex() { $this->checkLogin(); $billConfig = BillConfig::model()->find(); if (empty($billConfig)) { $billConfig = new BillConfig(); } // Save if (!empty($_POST)) { $billConfig->slip_font_size = Util::input($_POST['BillConfig']['slip_font_size']); $billConfig->slip_width = Util::input($_POST['BillConfig']['slip_width']); $billConfig->slip_height = Util::input($_POST['BillConfig']['slip_height']); $billConfig->slip_paper = Util::input($_POST['BillConfig']['slip_paper']); $billConfig->slip_position = Util::input($_POST['BillConfig']['slip_position']); $billConfig->bill_send_product_width = Util::input($_POST['BillConfig']['bill_send_product_width']); $billConfig->bill_send_product_height = Util::input($_POST['BillConfig']['bill_send_product_height']); $billConfig->bill_send_product_paper = Util::input($_POST['BillConfig']['bill_send_product_paper']); $billConfig->bill_send_product_position = Util::input($_POST['BillConfig']['bill_send_product_position']); $billConfig->bill_send_show_line = @Util::input($_POST['bill_send_show_line']); $billConfig->bill_drop_width = Util::input($_POST['BillConfig']['bill_drop_width']); $billConfig->bill_drop_height = Util::input($_POST['BillConfig']['bill_drop_height']); $billConfig->bill_drop_paper = Util::input($_POST['BillConfig']['bill_drop_paper']); $billConfig->bill_drop_position = Util::input($_POST['BillConfig']['bill_drop_position']); $billConfig->bill_drop_show_line = @Util::input($_POST['bill_drop_show_line']); $billConfig->bill_add_tax_width = Util::input($_POST['BillConfig']['bill_add_tax_width']); $billConfig->bill_add_tax_height = Util::input($_POST['BillConfig']['bill_add_tax_height']); $billConfig->bill_add_tax_paper = Util::input($_POST['BillConfig']['bill_add_tax_paper']); $billConfig->bill_add_tax_position = Util::input($_POST['BillConfig']['bill_add_tax_position']); $billConfig->bill_add_show_line = @Util::input($_POST['bill_add_show_line']); $billConfig->sale_width = Util::input($_POST['BillConfig']['sale_width']); $billConfig->sale_height = Util::input($_POST['BillConfig']['sale_height']); $billConfig->sale_paper = Util::input($_POST['BillConfig']['sale_paper']); $billConfig->sale_position = Util::input($_POST['BillConfig']['sale_position']); $billConfig->sale_condition_show_line = @Util::input($_POST['sale_condition_show_line']); if ($billConfig->save()) { $this->redirect(array('BillConfigIndex')); } } $this->render('//Config/BillConfigIndex', array('billConfig' => $billConfig)); }
$vat = number_format($bill_sale_detail_price_vat, 2); $product = Product::model()->findByAttributes(array('product_code' => $product_code)); $weight = $product->weight; $sum_weight += $weight; if (empty($weight)) { $weight = 0; } $content .= "\r\n <tr>\r\n <td class='cell' style='text-align: center'>{$i}</td>\r\n <td class='cell' width='180px'>{$product_code}</td>\r\n <td class='cell'>{$product_name}</td>\r\n <td class='cell' style='text-align: right'>{$weight}</td>\r\n <td class='cell' style='text-align: right'>{$product_price}</td>\r\n <td class='cell' style='text-align: right'>{$product_qty}</td>\r\n <td class='cell' style='text-align: right'>{$price_per_row}</td>\r\n </tr>"; $i++; } // table footer $sum_qty = number_format($sum_qty); $sum_price = number_format($sum); $content .= "\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td class='text bold'>รวม</td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n <td class='cell cell-footer'>{$sum_qty}</td>\r\n <td class='cell cell-footer'>{$sum_price}</td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <br />"; $billSale = BillSale::model()->findByPk($billSaleId); $billConfig = BillConfig::model()->find(); $vat_type = $billSale->vat_type; $out_vat = $billSale->out_vat * 1; $total_price = $sum; if ($vat_type == 'out') { $total_price = $sum + $out_vat; } $money = number_format($out_vat, 2); $money_add = number_format($total_price, 2); $bonus_price = number_format($billSale->bonus_price, 2); $total_pay = number_format($total_price - $billSale->bonus_price, 2); $money_add_total = $total_price - $out_vat; $money_add_total = number_format($money_add_total, 2); $content .= "<table width='300px'>"; if ($billSale->bill_sale_vat == 'vat') { $content .= "\r\n <tr>\r\n <td>vat ประเภท</td>\r\n <td style='text-align: right'>{$vat_type}</td>\r\n </tr>\r\n <tr>\r\n <td>จำนวนเงิน</td>\r\n <td style='text-align: right'>{$money}</td>\r\n </tr>\r\n ";
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)); }