protected function initTpl($params) { $contragent_id = $params['contragent_id']; $contragent = Model_Contragent::load($contragent_id); $start_from = toZendDate($params['start_from']); $start_till = toZendDate($params['start_till']); $deposit_from = Core_Balance::getDepositToDate($contragent->getId(), $start_from); $deposit_till = Core_Balance::getDepositToDate($contragent->getId(), $start_till); $transactions = $this->getTransactions($contragent->getId(), $params); $info = $this->prepareTransactions($transactions, $start_from, $start_till); // Корректировка границ из-за того, что дата выписки не совпадает с датой транзакции $common_correction = $this->getCommonCorrection($contragent->getId(), $start_from, $start_till); $deposit_from += $info['deposit_from_correct'] + $common_correction; $deposit_till -= $info['deposit_till_correct'] - $common_correction; $lic_number = is_null($contragent->getAccount()) ? generateAccount($contragent->getId()) : $contragent->getAccount(); $result = array('date_from' => $start_from->get(getTimeFormat('date')), 'date_till' => $start_till->get(getTimeFormat('date')), 'supplier.full_name' => $contragent->getFullName(), 'supplier.email' => $contragent->getEmail(), 'supplier.lic_number' => $lic_number, 'transactions.info' => $this->renderTransaction($info['transactions']), 'deposit.from' => HumanizePrice($deposit_from, true), 'deposit.till' => HumanizePrice($deposit_till, true), 'debet.total' => HumanizePrice($info['total_debet'], true), 'credit.total' => HumanizePrice($info['total_credit'], true), 'deposit.till.str' => HumanizePrice($deposit_till, true), 'deposit.till.rustr' => num2str($deposit_till), 'sign_and_stamp' => $this->renderSignAndStamp()); return $result; }
<div class="column span-10 last" style="text-align: left; border: 1px solid #000000; border-bottom: none; border-left: none; padding: 3px;"> <?=$ds->transfer?> </div> <div class="column span-8" style="text-align: left; border: 1px solid #000000; padding: 3px;"> <b>Страховка</b> </div> <div class="column span-10 last" style="text-align: left; border: 1px solid #000000; border-left: none; padding: 3px;"> <?=$ds->cif?> </div> <br><br> <div class="column span-24 last" style="text-align: left; padding: 3px;"> Додатково: <?=$ds->excursions?> </div> <div class="column span-24 last" style="text-align: left; padding: 3px;"> Загальна вартість туристичних послуг (цифрами та прописом): <?=$ds->sum?> (<?=num2str($ds->sum)?>) </div> <div class="column span-24 last" style="text-align: left; padding: 3px;"> Телефони (дом., моб.): <?$demander_info = get_client_info($demander->_clients_rid)?><?=$demander_info->phones?> </div> <div class="column span-12" style="text-align: left;margin-top: 30px;"> ВІДПОВІДАЛЬНИЙ МЕНЕДЖЕР<br> <br> ________________________/<?=get_curr_uname()?>/ <br><br> М.П. </div>
function fill_invoice($filename, $invoice_number = '', $invoice_date = '', $smi = '', $client_details = '', $product_list = '', $total = '', $count = '', $invoice_period = '', $contract_number = '', $contract_date = '') { if ($invoice_number == '') { $invoice_number = '____'; } $today = getdate(); if ($invoice_date == '') { $invoice_date = $today[mday] . "." . $today[mon] . "." . $today[year]; } if ($client_details == '') { $client_details = 'данные покупателя неизвестны'; } if ($product_list == '') { $product_list = '<tr><td colspan=6> нет </td></tr>'; } if ($total == '') { $total = 0; } if ($count == '') { $count = 0; } $content = loadFile($filename); $total_rub_text = "<b>" . capitalizefirst(num2str($total)) . "</b>"; // replace placeholders $content = str_replace('{invoice_number}', $invoice_number, $content); $content = str_replace('{invoice_date}', $invoice_date, $content); $content = str_replace('{smi}', $smi, $content); $content = str_replace('{client_details}', $client_details, $content); $content = str_replace('{product_list}', $product_list, $content); $content = str_replace('{total}', $total, $content); $content = str_replace('{count}', $count, $content); $content = str_replace('{total_rub_text}', $total_rub_text, $content); $content = str_replace('{invoice_period}', $invoice_period, $content); $content = str_replace('{contract_number}', $contract_number, $content); $content = str_replace('{contract_date}', $contract_date, $content); // output content //pokazh($content); return $content; }
foreach ($dbh->query('SELECT s.id id,s.unit unit, (SELECT code FROM units_default WHERE id=s.unit) unit_name FROM services_products s WHERE s.id=' . $dish['dish_id']) as $unit) { $unit_name = $unit['unit_name']; } $i++; $text .= '<tr><td class="second right">' . $i . ' </td><td class="second"> ' . $dish['dish_name'] . '</td><td class="second center">' . $unit_name . '</td><td class="second right">' . $dish['price'] . ' </td><td class="second right">' . $dish['dish_qt'] . ' </td><td class="second right">' . $dish['price'] * $dish['dish_qt'] . ' </td></tr>'; $unit_name = ''; } foreach ($dbh->query('SELECT * FROM `payment_details_pay` WHERE op_id="' . $row['id'] . '"') as $pay) { } } //------------------------------------------------------------------------ $text .= '</table>'; $text .= '<div class="footer">'; $text .= "Всего наименований " . $i . ", на сумму " . $row['price_all'] . " руб. <br><strong>" . first_up(num2str($row['price_all'])) . "</strong>"; $text .= '</div><br><br>'; $text .= ' <table> <tr> <td style="width:55px;" class="footer_right">Отпустил</td> <td style="border-bottom: 1px solid black;width:100px;"></td> <td style="width:15px;"> </td> <td style="border-bottom: 1px solid black;width:150px; text-align:center;">' . $row['empl'] . '</td> <td style="width:15px;"> </td> <td style="border-bottom: 1px solid black;width:150px; text-align:center;">' . $row['cashier_name'] . '</td> </tr> <tr> <td style="width:55px;"></td> <td style="width:100px; text-align:center;">(подпись)</td> <td style="width:15px;"></td>
<th>员工卡号</th> <th>状态</th> <th>加入时间</th> <th>管理员</th> <th>允许点餐</th> <th>操作</th> </tr> </thead> <tbody> <?php $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN)); $sp = "{call web_get_canteen_user(?)}"; $rs = sp_execute($sp, $params); // foreach ($rs as $row) { $uids = num2str(userid_content, $row["uid"]); ?> <tr> <td> <img src="<?php echo strlen($row["HeadURL"]) > 0 ? $row["HeadURL"] : CFG_HTTP . CFG_USER_DEFAULT; ?> " width="24px" height="24px;"> </td> <td><?php echo $row["Nickname"]; ?> </td> <td><?php echo $row["rname"]; ?>
</table> <center><table border=1 width=541><tr border=1><td width=29>№</td><td>Наименование</td><td width=74></center>Сумма</center></td></tr>'; for ($i = 0; $i < count($work) && $i < count($price); $i++) { $v = $i + 1; $html2 = $html2 . '<tr><td>' . $v . '</td><td>' . $work[$i] . '</td><td>' . $price[$i] . '</td></tr>'; $summa = $summa + $price[$i]; if (!isset($_GET['aktNumber'])) { $add_aktswork = $connect_db->prepare("INSERT INTO `aktswork` (`number`, `user`, `fiok`, `work`, `price`, `summa`) VALUE (?,?,?,?,?,?)"); $add_aktswork->bind_param("isssii", $number, $user, $who, $work[$i], $price[$i], $pre_sum); $add_aktswork->execute(); $add_aktswork->close(); } } $html3 = '</tbody></table> <table width=783><tr><td><br>Итоговая сумма к оплате: ' . $summa . ',00 руб.<br>Сумма прописью: <b>' . num2str($summa) . '</b> </td></tr><tr><td>Работы выполнены в полном объеме, в установленные сроки и с надлежащим качеством. Стороны претензий друг к другу не имеют. </td></tr></table> <table width=783 height=95><tr><td><br /><br />Исполнитель: ______________</td><td><br /><br />Заказчик: ______________</td></tr></table> <br /><br /><br /><br /><br /><br />'; $html = $html1 . $html2 . $html3; $number++; if (!isset($_GET['aktNumber'])) { $connect_db->query("UPDATE `number` SET `aktvyprab` = '{$number}'"); } //echo $html; /* Конвертим в PDF */ include "mpdf/mpdf.php"; $mpdf = new mPDF('utf-8', 'A4', '8', '', 10, 10, 7, 7, 10, 10); /*задаем формат, отступы и.т.д.*/ $mpdf->charset_in = 'utf8'; /*не забываем про русский*/
/** * 将餐厅信息设置到session中 * @param $row */ function set_canteen_session($row) { $_SESSION["cid"] = $row["cid"]; $_SESSION["cname"] = $row["cname"]; $_SESSION["verticket"] = $row["verticket"]; $_SESSION["verurl"] = $row["verurl"]; $_SESSION["allow"] = $row["allow"]; $_SESSION["cpicurl"] = $row["picurl"]; $_SESSION["ctelnum"] = $row["telnum"]; $_SESSION["roleid"] = $row["roleid"]; //判断餐厅是否有二维码,没有则创建生成二维码 if (strlen($row["verticket"]) < 1) { /* 根据餐厅编号生成带场景二维码 */ $str = num2str(canteenid_content, $_SESSION["cid"]); $token = db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"]; $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$token}"; $data = '{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_id":234, "scene_str":"' . $str . '"}}}'; $data = json_decode(get_http_result($url, $data), true); //插入数据库,更新餐厅二维码信息 $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array("" . $data["ticket"], SQLSRV_PARAM_IN), array("" . $data["url"], SQLSRV_PARAM_IN), array("", SQLSRV_PARAM_IN)); sp_execute("{call web_set_canteen_verify(?,?,?,?)}", $params); $_SESSION["verticket"] = $data["ticket"]; } }
<?php echo num2str($sum); if ($contract_num) { ?> . <?php if ($sbr_nds) { ?> В том числе НДС 18% — <?php echo num2str($sbr_nds); ?> <?php if ($sbr_comm) { ?> с суммы агентского вознаграждения ООО "Ваан" — <?php echo num2str($sbr_comm); ?> . <?php } ?> <?php } else { ?> <?php } ?> <?php } ?>
if ($doc_number != '') { $credit_pay = 1; } // Стоимость без скидки; // Если у нас была скидка, то нам надо вычесть ее стоимость; $work_summ = $warranty_data['summa'] - $warranty_data['summ_det']; if ($rko_doc_data != '' && $credit_pay == 0) { // Скидку мы посчитали выше; } else { $discount_sum = 0; } $numm_sum = get_money_format($warranty_data['summa']); // Итоговая сумма к оплате; $itog_sum = get_money_format($warranty_data['summa'] - $discount_sum); // Сумма прописью; $itog_sum_text = num2str($warranty_data['summa'] - $discount_sum); ?> <style> body, html{ font-family: 'Arial'; /*page-break-inside: avoid;*/ font-size: 0.8em; } table{ font-size: 0.9em; } td{ padding: 5px 5px 5px 5px; } </style>
public function pricelong($value) { return num2strL($value) . ' (' . num2str($value) . ')'; }
if (!isset($_SESSION['login'])) { echo '<script language="JavaScript" type="text/javascript"> <!-- location="' . $_SERVER['DOCUMENT_ROOT'] . 'index.php" //--> </script>'; } require $_SERVER['DOCUMENT_ROOT'] . "/config.php"; $modal_title_start = '<div style="width: 100%; background: rgba(117, 192, 0, 0.7); color: #fff;"><center><h2 style="padding: 5px; margin: 5px 0 0 0;">'; $modal_title_end = '</h2></center></div>'; echo '<div><a class="fancybox fancybox.iframe" href="http://' . $_SERVER['HTTP_HOST'] . '/inc/add.php?addprintform"><img width="30px" height="30px" src="http://' . $_SERVER['HTTP_HOST'] . '/img/add.jpg" title="Добавить печатную форму" alt="Добавить печатную форму"></a></div>'; $nomer = 1; $today = date("d.m.Y"); $who = 'Мне'; $sum = 1000; $summa = $sum . ',00 руб.<br><b>' . num2str($sum) . '</b>'; $select_form = $connect_db->query("SELECT * FROM `form` WHERE `id_s` = 'akt_vip_rab'"); while ($fetch_form = $select_form->fetch_assoc()) { // Рисуем форму echo $modal_title_start . $fetch_form['name'] . $modal_title_end; echo '<div class="edit-form">'; echo '<div class="buttom-form"> <a class="fancybox fancybox.iframe" href="http://' . $_SERVER['HTTP_HOST'] . '/inc/edit.php?editaktviprab?id_s=' . $fetch_form['id_s'] . '"><img width="30px" height="30px" src="http://' . $_SERVER['HTTP_HOST'] . '/img/edit.jpg" title="Редактировать форму" alt="Редактировать форму"></a>'; echo '</div>'; echo '<div class="form">'; $head = stripslashes($fetch_form['head']); //Удаляем экранирующие слеши // Замена шорткодов $search = array('#logo#', '#nomer#', '#today#', '#who#', '#summa#'); // Кого меняем $replace = array($logo, $nomer, $today, $who, $summa);
<th width="150px">创建日期</th> <th width="226px">操作</th> </tr> </thead> <tbody> <?php //查询全部餐厅信息 $_SESSION["uid"] = 4; $tid = 0; $params = array(array(intval($_SESSION["uid"]), SQLSRV_PARAM_IN), array($tid, SQLSRV_PARAM_IN)); $rs = sp_execute("{call web_get_topic_list(?,?)}", $params); foreach ($rs as $row) { ?> <tr> <td id="<?php echo num2str(CFG_ID_TOPIC, $row["tid"]); ?> "><?php echo $row["tname"]; ?> </td> <td><?php echo $row["authname"]; ?> </td> <td align="right" style="padding-right:6px;"><?php echo $row["vn"]; ?> </td> <td><?php echo is_object($row["cdt"]) ? $row["cdt"]->format("Y-m-d H:i:s") : "";
</h3> <img src="vo_qrcode.php?tids=<?php echo num2str(CFG_ID_TOPIC, $_SESSION["tid"]); ?> &vids=<?php echo $_REQUEST["vids"]; ?> " width="300px" height="300px;"> <h5>扫描上方二维码,查看语音【<?php echo $rs[0]["title"]; ?> 】</h5> <h5 style="margin-top:10px; padding-left:200px;"> <div style="float:left">链接:</div> <div id="clip_text_imgurl1" style="float:left"><?php echo CFG_HTTP . "mobile/tp_voice_detail.php?tids=" . num2str(CFG_ID_TOPIC, $_SESSION["tid"]) . "&vids=" . $_REQUEST["vids"]; ?> </div> <a class="copy" id="clip_btn_imgurl1" data-clipboard-target="clip_text_imgurl1"><div style="float:left">点击复制</div></a> </h5> </div> </div> <div class="fc"></div> </div> <?php include_once "footer.php"; ?> <script src="plugins/ZeroClipboard/ZeroClipboard.min.js"></script> <script> $(function(){ var clip_imgurl1 = new ZeroClipboard(document.getElementById("clip_btn_imgurl1"),{moviePath:"plugins/ZeroClipboard/ZeroClipboard.swf"});
/** * НЕ ИСПОЛЬЗОВАТЬ - УСТАРЕЛ СМ generateInvoice2. * * Генерация счета * * @todo: может перенести генерацию в очереди? * @todo: но тогда нужно организовать обратную связь. * * @param type $user_info * * @return bool|\CFile */ public function generateInvoice($user_info) { extract($this->options); $file = new CFile(); $file_path = $this->getFilePath(); $reserve_id = @$this->data['reserve_id']; if (!$file_path || !$reserve_id || empty($this->data)) { return false; } $data = $this->getCheckByReserveId($reserve_id); if (isset($data['payed_date']) && !empty($data['payed_date'])) { return false; } if (isset($data['check_file_id']) && $data['check_file_id'] > 0) { $file->Delete($data['check_file_id']); } if (!$data) { $data = array(); } $this->data = array_merge($data, $this->data, $user_info); $data = $this->data; $bill_num = sprintf($bill_num_format, $data['reserve_id']); $data['bill_num'] = $bill_num; $data['date'] = date_text($data['date'], 'd'); $data['price_txt'] = num2str(intval($data['price'])); $data['price'] = number_format($data['price'], 2, ',', ''); $data['title'] = sprintf($check_title, $bill_num); foreach ($data as $key => $value) { $data['$' . $key] = $value; unset($data[$key]); } $pdf = new odt2pdf($invoice_template); $pdf->setFolder(ABS_PATH . $templates_path); $pdf->convert($data); $content = $pdf->output(null, 'S'); $len = strlen($content); if (!$len) { return false; } $file->path = $file_path; $file->table = $table_files; $file->size = $len; $file->src_id = $src_id; $file->name = basename($file->secure_tmpname($file->path, '.pdf')); $file->original_name = change_q_x(sprintf($check_org_filename, $bill_num)); if (!$file->putContent($file->path . $file->name, $content)) { return false; } $this->data['check_file_id'] = $file->id; return $this->addCheck() ? $file : false; }
<?php // Тут мы будем обрабатывать данные для вывода формы печати; if (isset($_POST['rko_id']) && $_POST['rko_id'] != '') { $sql = "SELECT * FROM `rko` WHERE `id` = '" . $_POST['rko_id'] . "';"; $rko_row = $db_rs->row($sql); // Собираем все переменные в кучу; if ($rko_row['print_doc_num'] != '') { $rko_id = $rko_row['print_doc_num']; } else { $rko_id = $rko_row['id']; } $rko_date = date('d.m.Y'); $rko_receiver = $rko_row['selected_name']; $rko_reason = $rko_row['reason']; $rko_sum = num2str($rko_row['sum']); $rko_sum_int = $rko_row['sum']; switch ($_SESSION['company']) { case 'rem': $logo = '<img src="data:;base64,' . base64_encode(file_get_contents('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/templates/images/icons/logo.png')) . '" width="80px"/>'; $ip = 'ИП Ахметов Э.В.'; $inn = '245905040088'; $sc_address = 'Ленина, д.3 | Ватутина д.27 | Дуси Ковальчук д.266 | Бориса Богаткова д.208'; $phone = '(383) 383-08-91'; $web = 'www.remontof.net'; break; case 'air': $logo = '<img src="data:;base64,' . base64_encode(file_get_contents('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/templates/images/icons/air_logo.png')) . '" width="80px"/>'; $ip = 'ИП Миллер Д.Л.'; $inn = '540538154085'; $sc_address = 'Ленина, д.3 Цоколь';
/** * Генерируем заявление на открытие аккредитива (только заказчику - юрику) * * @param string $error * @param type $lc * @return type */ public function generateStatement(&$error, $lc = false) { require_once dirname(__FILE__) . '/num_to_word.php'; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/LocalDateTime.php"; $template = $_SERVER['DOCUMENT_ROOT'] . '/norisk2/xml/doc_statement.xml'; $sbr_num = $this->sbr->getContractNum(null, null); $this->sbr->getFrlReqvs(); $this->sbr->getEmpReqvs(); $this->sbr->setCheckEmpReqvs($this->id); if (!$lc) { $pskb = new pskb($this->sbr); $lc = $pskb->getLC(); } $days_acredit = round((strtotime($lc['dateExecLC']) - time()) / (3600 * 24)); $days_acredit = $days_acredit . " " . ending($days_acredit, 'день', 'дня', 'дней'); if ($lc['ps_frl'] == onlinedengi::BANK_YL) { $frl_reqv_payment = $lc['accPerf'] . "\r\n"; $frl_reqv_payment .= "БИК: {$lc['psPerf']}"; } else { $frl_reqv_payment = $lc['accPerf']; } if ($lc['ps_emp'] == onlinedengi::BANK_YL) { $emp_reqv_payment = $lc['accCust'] . "\r\n"; $emp_reqv_payment .= "БИК: {$lc['psCust']}"; } else { $emp_reqv_payment = $lc['accCust']; } if ($lc['ps_frl'] == onlinedengi::WMR || $lc['ps_frl'] == onlinedengi::YD) { $tax_percent_vaan = '5.4%'; //@todo надо как то эти цифры брать из схемы $tax_percent_bank = '0.6%'; } elseif ($lc['ps_frl'] != pskb::WW) { $tax_percent_vaan = '2.5%'; $tax_percent_bank = '0.5%'; } else { $tax_percent_bank = '0%'; } $tax_percent_bank = sbr_meta::getTaxPercent(sbr::FRL, pskb::$exrates_map[$lc['ps_frl']], 'Комиссия Банка', $this->sbr->scheme_type) . "%"; $dvals = array('P' => pskb::$exrates_map[$lc['ps_emp']]); $tax_total = 0; $tax_bank = 0; $total_cost = $this->sbr->cost; foreach ($this->sbr->scheme['taxes'][sbr::EMP] as $tax) { if ($tax['tax_code'] != 'TAX_FL') { $tax_bank += sbr_meta::calcAnyTax($tax['tax_id'], $tax['scheme_id'], $total_cost, $dvals); //$stage->calcTax($tax, $dvals, $outsys); continue; } $tax_total += sbr_meta::calcAnyTax($tax['tax_id'], $tax['scheme_id'], $total_cost, $dvals); //$stage->calcTax($tax, $dvals, $outsys); if (!floatval($tax_total)) { continue; } } $sum_reserved = $this->sbr->getReserveSum(true, pskb::$exrates_map[$lc['ps_emp']]); $sum_vaan = num2strL(round($tax_total, 2)); $sum_vaan_nds = num2strEx(round($tax_total / 118 * 18, 2)); $replace = array('$sbr_num' => $sbr_num, '$sbr_date' => date("d.m.Y", strtotime($this->sbr->sended)), '$efio' => $lc['nameCust'], '$ffio' => $lc['namePerf'], '$num_acredit' => $lc['lc_id'], '$date_acredit' => date('d.m.Y'), '$sum' => num2strL($this->sbr->cost), '$sum_str' => num2str($this->sbr->cost, true), '$emp_payment_method_name' => pskb::$psys[pskb::USER_EMP][$lc['ps_emp']], '$emp_reqv_payment' => $emp_reqv_payment, '$frl_payment_method_name' => pskb::$psys[pskb::USER_FRL][$lc['ps_frl']], '$frl_reqv_payment' => $frl_reqv_payment, '$frl_phone' => $lc['numPerf'], '$days_acredit' => $days_acredit, '$tax_percent_vaan' => $tax_percent_vaan, '$tax_percent_bank' => $tax_percent_bank, '$sum_vaan' => $sum_vaan, '$sum_vaan_nds' => $sum_vaan_nds, '$sum_reserved' => num2strL($sum_reserved), '$sum_reserved_str' => num2str($sum_reserved, true), '$tax_bank' => num2strL($tax_bank), '$sum_d' => num2strD($this->sbr->cost), '$tax_bank_d' => num2strD($tax_bank), '$sum_vaan_d' => num2strD(round($tax_total, 2)), '$sum_vaan_nds_d' => num2strD(round($tax_total / 118 * 18, 2))); $pdf = sbr::xml2pdf($template, $replace); if (!($file = $this->sbr->_saveDocFile($pdf->Output(NULL, 'S')))) { $error['fatal'] = "Ошибка при формировании Заявление на открытие аккредитива"; } return $file; }
<?php // Тут мы будем обрабатывать данные для вывода формы печати; if (isset($_POST['pko_id']) && $_POST['pko_id'] != '') { $sql = "SELECT * FROM `pko` WHERE `id` = '" . $_POST['pko_id'] . "';"; $pko_row = $db_rs->row($sql); // Собираем все переменные в кучу; if ($pko_row['print_doc_num'] != '') { $doc_num = $pko_row['print_doc_num']; } else { $doc_num = 'NULL'; } $current_date = date('d.m.Y'); $money_from = $pko_row['selected_name']; $reason_text = $pko_row['reason']; $sum = $pko_row['sum']; $sum_text = num2str($pko_row['sum']); $user_name = $_SESSION['user_fio']; switch ($_SESSION['company']) { case 'rem': $logo = '<img src="data:;base64,' . base64_encode(file_get_contents('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/templates/images/icons/logo.png')) . '" width="80px"/>'; $ip = 'ИП Ахметов Э.В.'; $inn = '245905040088'; $sc_address = 'Ленина, д.3 | Ватутина д.27 | Дуси Ковальчук д.266 | Бориса Богаткова д.208'; $phone = '(383) 383-08-91'; $web = 'www.remontof.net'; break; case 'air': $logo = '<img src="data:;base64,' . base64_encode(file_get_contents('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/templates/images/icons/air_logo.png')) . '" width="80px"/>'; $ip = 'ИП Миллер Д.Л.'; $inn = '540538154085'; $sc_address = 'Ленина, д.3 Цоколь';
} //Прочерки в списке допущенных лиц при выборе неограниченного числа if ($calc_data['drivers'] == 1) { $y = 0; for ($x = 1; $x < 5; $x++) { $pdf->SetXY(5, 182 + $y); $pdf->Write(0, '-----'); $pdf->SetXY(52, 182 + $y); $pdf->Write(0, '-----------------------------------------'); $pdf->SetXY(150, 182 + $y); $pdf->Write(0, '---------------------------------------'); $y = $y + 5.8; } } //Страховая премия $tarif = num2str($calc_result['t']); $tarif = iconv('utf-8', 'windows-1251', $tarif); $pdf->SetXY(40, 236); $pdf->Write(0, $calc_result['t'] . ' (' . $tarif . ')'); //Особые отметки $special_notes = iconv('utf-8', 'windows-1251', $contract_data['special_notes']); if (!empty($contract_data['a7_number'])) { $special_notes .= iconv('utf-8', 'windows-1251', ' Квитанция А7 № ' . $contract_data['a7_number']); } $pdf->SetXY(5, 250); $pdf->Write(0, $special_notes); //Дата заключения договора $date_create = date('d.m.Y', strtotime($contract_data["time_create"])); $pdf->SetXY(52, 263); $pdf->Write(0, $date_create[0] . $date_create[1]); $month = get_month($date_create[3] . $date_create[4]);
/** * 餐厅管理人员受理订单后,发送消息给用户 * 取餐通知 * 格式: * 商店名称 * 订单编号 * 订单类型 * 付款状态 * @param $cids 餐厅编号 * @param $oid 订单编号 * @param $uname 用户姓名 * @param $cname 餐厅名称 * @param $winname 窗口名称 * @param $paysta 支付状态 * @param $uid 用户编号 * @param $amount 菜品数量 * @param $total 总价 * @param $towid 接收消息的微信号 */ function altermsg_for_sales($cids, $oid, $uname, $cname, $winname, $paysta, $uid, $amount, $total, $towid) { $token = db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"]; $oids = num2str_x(orderid_content_x, $oid); $uids = num2str(userid_content, $uid); $pre_str = '{"first": {"value":"%s,在【%s】取餐","color":"#000000"},"storeName":{"value":"%s","color":"#000000"},"orderId":{"value": "%s","color":"#000000"},"orderType":{"value":"默认","color":"#000000"},"remark":{"value":"订单数量:%s\\r\\n订单金额:¥%0.2f\\r\\n付款状态:%s\\r\\n\\r\\n点击查看订单详情,并完成销售","color":"#000000"}}'; $data = sprintf($pre_str, $uname, $winname, $cname, $oids, $amount, $total, $paysta); send_template_message($token, $towid, CFG_TPMSG_QUCAN, CFG_HTTP . "mobile/admin_order_list.php?act=preuids&cids={$cids}&uids={$uids}", "#7B68EE", $data); }
//require_once($_SERVER['DOCUMENT_ROOT'] . '/classes/odt2pdf.php'); require_once 'ActOdt2Pdf.php'; if (!empty($issues)) { $total_hours = isset($_GET['h']) ? intval($_GET['h']) : DEFAULT_TOTAL_HOURS; $per_hour = isset($_GET['p']) ? intval($_GET['p']) : DEFAULT_PER_HOUR; $total_price = $per_hour * $total_hours; $total_price_format = number_format($total_price, 2, ',', ''); $total_price_parts = explode(',', $total_price_format); $act_date = '«' . date('j', $date_to_time) . '» ' . monthtostr(date('n', $date_to_time), true) . ' ' . date('Y', $date_to_time); $affix_date_time = $date_from_time; //strtotime('+ 1 day', $date_to_time); $affix_date = '«' . date('j', $affix_date_time) . '» ' . monthtostr(date('n', $affix_date_time), true) . ' ' . date('Y', $affix_date_time); $date_dog_time = strtotime(DATE_DOG); $date_dog = date('j', $date_dog_time) . ' ' . monthtostr(date('n', $date_dog_time), true) . ' ' . date('Y', $date_dog_time); //Подстановка для акта $act_val = array('$date_dog' => $date_dog, '$date_dog2' => DATE_DOG, '$worker_addr' => WORKER_ADDR_TXT, '$worker_fio' => WORKER_FIO_TXT, '$worker_bank' => WORKER_BANK_TXT, '$worker_sign' => WORKER_SIGN_TXT, '$num' => ACT_NUM, '$act_date' => $act_date, '$affix_num' => AFX_NUM, '$date_from' => $date_from, '$date_to' => $date_to, '$per_hour' => $per_hour . ' руб. 00 коп', '$total_hours' => $total_hours, '$total_price' => $total_price_format, '$total_price2' => $total_price_parts[0], '$total_price3' => $total_price_parts[1], '$total_price_txt' => trim(str_replace(array('рублей', 'рубля', ' Российской Федерации', '00 копеек'), array('', '', '', ''), num2str($total_price_parts[0])))); //Подстановка для приложения $act_affix = array('$num' => AFX_NUM, '$date_dog' => $date_dog, '$date_from' => $date_from, '$date_to' => $date_to, '$act_date' => $affix_date, '$worker_addr' => WORKER_ADDR_TXT, '$worker_fio' => WORKER_FIO_TXT, '$worker_bank' => WORKER_BANK_TXT, '$worker_sign' => WORKER_SIGN_TXT, '$services' => ''); $cnt = count($issues); $h = $total_hours / $cnt; $ah = round($h); $lh = $total_hours - $ah * ($cnt - 1); foreach ($issues as $key => $issue) { $idx = $key + 1; $summary = iconv('UTF-8', 'WINDOWS-1251', $issue->summary); $act_val['$service' . $idx] = "#{$issue->id} {$summary}"; $act_affix['$services'] .= $act_val['$service' . $idx] . ($idx < $cnt ? PHP_EOL . PHP_EOL : ''); $hours = $key < $cnt - 1 ? $ah : $lh; $act_val['$hours' . $idx] = $hours; $cost = $per_hour * $hours; $act_val['$price' . $idx] = number_format($cost, 2, ',', '');
*/ require_once "../config.php"; require_once "../conn.php"; require_once "../include/php_funs.php"; require_once "../db_weixin_funs.php"; require_once "admin_filter.php"; //检查权限 if (!filter_canteenadmin()) { exit; } $cid = str2num(canteenid_content, $_REQUEST["cids"]); $verurl = $_REQUEST["verurl"]; if ($verurl == "") { /* 根据餐厅编号生成带场景二维码 */ //餐厅编号 $str = num2str(canteenid_content, $cid); $token = db_get_token_ticket(CFG_APPID, CFG_SECRET)["token"]; $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$token}"; /* * 永久二维码请求说明 * http请求方式: POST * URL: https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN * POST数据格式:json * POST数据例子:{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": 123}}} * 或者也可以使用以下POST数据创建字符串形式的二维码参数: * {"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "123"}}} */ $data = '{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_id":234, "scene_str":"' . $str . '"}}}'; $data = json_decode(get_http_result($url, $data), true); // //插入数据库,更新餐厅二维码信息
sp_execute("{call web_set_canteen_verify(?,?,?,?)}", $params); $status = "ok"; $info = $picurl; } // } else { if ($action == "user_set_sales_win") { $winids = $_REQUEST["winids"]; $winid = str2num(saleswin_content, $winids); $winname = $_POST["winname"]; //生成二维码 $path = dirname(__FILE__) . "/upload/qrcode/"; $name = md5(time()) . '.png'; $filename = $path . $name; //ready param $cids = num2str(canteenid_content, $_SESSION["cid"]); $codeText = CFG_HTTP . "mobile/sales_scan.php?cids={$cids}&winids={$winids}"; QRcode::png($codeText, $filename, L, 12, 2); $winver = "qrcode/{$name}"; $windesc = $_POST["windesc"]; db_log("winid:{$winid}, winname:{$winname}, verurl:{$winver}, desc:{$windesc}, cid:" . $_SESSION["cid"]); $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array($winid, SQLSRV_PARAM_IN), array("" . $winname, SQLSRV_PARAM_IN), array("" . $winver, SQLSRV_PARAM_IN), array("" . $windesc, SQLSRV_PARAM_IN)); sp_execute("{call web_set_sales_win(?,?,?,?,?)}", $params); $status = "ok"; $info = $name; } else { if ($action == "set_canteen_allow_order") { $params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array(intval($_REQUEST["orden"]), SQLSRV_PARAM_IN)); sp_execute("{call web_set_canteen_sale_state(?,?)}", $params); $status = "ok"; $info = "成功";
function formCaptcha($attributes = false, $alphanumeric = false) { $hash = md5(getURL()); $HTML = '<input type="hidden" name="captcha_token" value="' . $hash . '" />'; $HTML .= '<input type="hidden" name="captcha_type" value="' . ($alphanumeric ? 'alphanumeric' : 'aritmethic') . '" />'; if (!$alphanumeric) { $attributes["style"] = (isset($attributes["style"]) ? $attributes["style"] : '') . "max-width: 50px; text-align: center;"; $attributes["type"] = "number"; $num1 = rand(1, 9); $num2 = rand(1, 9); switch (rand(1, 3)) { case 1: $operation = '-'; $answer = $num1 - $num2; break; default: $operation = '+'; $answer = $num1 + $num2; } $HTML .= __("How much is ") . (rand(0, 1) === 0 ? $num1 : num2str($num1, true)) . ' ' . $operation . ' ' . (rand(0, 1) === 0 ? $num2 : num2str($num2, true)) . '? '; } else { $attributes["style"] = (isset($attributes["style"]) ? $attributes["style"] : '') . "max-width: 200px; text-align: center;"; $answer = ""; $characters = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); for ($i = 0; $i < 5; $i++) { $answer .= $characters[rand(0, count($characters) - 1)]; } $HTML .= '<img src="' . path("captcha/{$hash}") . '" /><br />'; } SESSION("ZanCaptcha" . $hash, $answer); if (isset($attributes) and is_array($attributes)) { $attrs = null; foreach ($attributes as $attribute => $value) { if ($attribute === "required") { $attrs .= ' required '; } elseif ($attribute === "events") { $attrs .= ' ' . $value . ' '; } elseif ($attribute !== "p" and $attribute !== "field") { if (!preg_match('/"/', $value)) { $attrs .= ' ' . strtolower($attribute) . '="' . $value . '"'; } else { $attrs .= ' ' . strtolower($attribute) . "='" . $value . "'"; } } else { ${$attribute} = $value; } } $HTML .= '<input' . $attrs . ' type="text" /> '; if (isset($p) and $p and isset($field)) { $HTML = '<p><span class="field">» ' . $field . '</span><br />' . $HTML . '</p>'; } elseif (isset($p) and $p) { $HTML = '<p>' . $HTML . '</p>'; } elseif (isset($field)) { $HTML = '<span class="field">» ' . $field . '</span><br />' . $HTML . ''; } return $HTML; } elseif ($attributes) { return $HTML . '<input name="' . $attributes . '" type="text" />'; } else { return null; } }
<th>注册日期</th> <th>地址</th> <th>联系电话</th> <th>操作</th> </tr> </thead> <tbody> <?php $sp = "{call web_get_canteen_list}"; $rs = sp_execute($sp, null); // foreach ($rs as $row) { ?> <tr> <td id="<?php echo num2str(canteenid_content, $row["cid"]); ?> "><?php echo $row["cname"]; ?> </td> <td><?php echo $row["account"]; ?> </td> <td> <?php echo '<img src="' . CFG_HTTP . (strlen($row["picurl"]) > 0 ? CFG_SHOP_PATH . $row["picurl"] : CFG_SHOP_DEFAULT) . '" width="24px" height="24px;">'; ?> </td> <td width="4%">
<td style="text-align:center;" width="17%">Цена без НДС</td> <td style="text-align:center;" width="17%">Сумма без НДС</td> </tr>'; $num = 1; $kolichestvo = 1; $edizm = 'шт'; while ($fetch_raboty = $select_raboty->fetch_assoc()) { if ($fetch_raboty['razdel'] == 'visovi') { $bumajka = 'Квитанция №' . $fetch_raboty['subid'] . ': '; } else { $bumajka = ''; } $html3 = $html3 . '<tr><td style="text-align: center;">' . $num . '</td><td>' . $bumajka . $fetch_raboty['name'] . '</td><td style="text-align: center;">' . $edizm . '</td><td style="text-align: right;">' . $fetch_raboty['kol'] . '</td><td style="text-align: right;">' . $fetch_raboty['price'] . ' р.</td><td style="text-align: right;">' . $fetch_raboty['price'] * $fetch_raboty['kol'] . ',00 р.</td></tr>'; $num++; } $prsumm = num2str((int) $fetch_contragent['summa']); $html4 = '</table><table width="100%" border="0"><tr><td style="text-align:center;" width="5%"></td><td style="text-align:center;" width="40%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:right;" width="17%">Итого без НДС</td><td style="text-align:right;" width="17%" border="1">' . $fetch_contragent['summa'] . ' р.</td></tr> <tr><td style="text-align:center;" width="5%"></td><td style="text-align:center;" width="40%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:right;" width="17%">Итого НДС</td><td style="text-align:right;" width="17%" border="1">---</td></tr> <tr><td style="text-align:center;" width="5%"></td><td style="text-align:center;" width="40%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:center;" width="10%"></td><td style="text-align:right;" width="17%">Всего к оплате:</td><td style="text-align:right;" width="17%" border="1">' . $fetch_contragent['summa'] . ' р.</td></tr> </table> <p>Всего наименований ' . --$num . ', на сумму ' . $fetch_contragent['summa'] . ',00 р., без НДС</p> <p><strong>' . $prsumm . '</strong></p>'; $html = $html1 . $html2 . $html3 . $html4; $connect_db->query("UPDATE `scheta` SET `status` = '1'"); $pdf_name = 'schet_' . $id . '.pdf'; /* Конвертим в PDF */ include "mpdf/mpdf.php"; $mpdf = new mPDF('utf-8', 'A4', '8', '', 10, 10, 7, 7, 10, 10); /*задаем формат, отступы и.т.д.*/ $mpdf->charset_in = 'utf8'; /*не забываем про русский*/
$cid = 0; $wid = ""; $sp = "{call web_get_user_list(?,?,?)}"; $params = array(array("" . CFG_WXPID, SQLSRV_PARAM_IN), array($cid, SQLSRV_PARAM_IN), array("" . $wid, SQLSRV_PARAM_IN)); $rs = sp_execute($sp, $params); // $i = 0; foreach ($rs as $row) { ?> <tr> <td><?php echo ++$i; ?> </td> <td id="<?php echo num2str(userid_content, $row["uid"]); ?> "> <img src="<?php echo strlen($row["headurl"]) > 0 ? $row["headurl"] : CFG_HTTP . CFG_USER_DEFAULT; ?> " width="16" height="16"> </td> <td><?php echo $row["nickname"]; ?> </td> <td><?php echo getmidstr(CFG_SUBSCRIBLE_MODE, $row["fellow"]); ?> </td>
<TD class="tr8 td0"></TD> <TD colspan=2 class="tr8 td19"><P class="p4 ft2">ИТОГО:</P></TD> <TD class="tr8 td15"><P class="p7 ft5"> </P></TD> <TD class="tr8 td16"><P class="p5 ft2">1</P></TD> <TD class="tr8 td20"><P class="p7 ft5"> </P></TD> <TD class="tr8 td17"><P class="p7 ft5"> </P></TD> <TD class="tr8 td18"><P class="p6 ft2">' . $_GET['price'] . '</P></TD> </TR> <TR> <TD class="tr6 td0"></TD> <TD class="tr6 td21"><P class="p7 ft6"> </P></TD> <TD class="tr6 td22"><P class="p7 ft6"> </P></TD> <TD class="tr6 td8"><P class="p7 ft6"> </P></TD> <TD class="tr6 td11"><P class="p7 ft6"> </P></TD> <TD class="tr6 td23"><P class="p7 ft6"> </P></TD> <TD class="tr6 td9"><P class="p7 ft6"> </P></TD> <TD class="tr6 td12"><P class="p7 ft6"> </P></TD> </TR> </TABLE> <P class="p8 ft2">Сумма прописью: ' . num2str($_GET['price']) . '. Без НДС</P> <P class="p9 ft2">Диагностику провел _____________________</P> </DIV> '; include "mpdf50/mpdf.php"; $mpdf = new mPDF('utf-8', 'A4', '8', '', 10, 10, 7, 7, 10, 10); $mpdf->charset_in = 'cp1251'; $stylesheet = file_get_contents('pdf1.css'); $mpdf->WriteHTML($stylesheet, 1); $mpdf->list_indent_first_level = 0; $mpdf->WriteHTML($html, 2); $mpdf->Output('mpdf.pdf', 'I');
</td> </tr> </tbody> </table><br><br> <table width="710px"><tr><td><center><b>ТОВАРНЫЙ ЧЕК № ' . $id . ' от ' . $data . ' г.</center></td></tr></table><br> <table width="710px" border="1" bordercolor="black" cellspacing="1" cellpadding="0"> <tbody> <tr><td width="25px"><center><b>№</b></center></td><td><b>Наименование товара, услуги</td><td width="50px"><center><b>Кол-во</b></center></td><td width="100px"><center><b>Цена, руб.</b></center></td><td width="100px"><center><b>Сумма, руб.</b></center></td></tr>'; $select_zakaz = $connect_db->query("SELECT * FROM `tezak` WHERE `user` = '{$user}'"); while ($fetch_zakaz = $select_zakaz->fetch_assoc()) { $summa = $fetch_zakaz['kol'] * $fetch_zakaz['price']; $html2 = $html2 . '<tr><td><center>' . $num_field . '</center></td><td>' . $fetch_zakaz['name'] . '</td><td><center>' . $fetch_zakaz['kol'] . '</center></td><td><center>' . $fetch_zakaz['price'] . '</center></td><td><center>' . $summa . '</center></td></tr>'; $itog = $itog + $summa; $num_field++; } $html3 = '<tr><td></td><td></td><td></td><td align="right"><b>Итого:</b></td><td><center><b>' . $itog . '</b></center></td></tr></tbody></table><br><br><br>Получено (сумма прописью): ' . num2str($itog) . ' <br><br>Продавец_____________________________/' . $fio_engineer . '/'; $html = $html1 . $html2 . $html3; // Имя файла $pdf_name = 'tovchek_' . $id . '.pdf'; // Обновляем номер товарника $connect_db->query("UPDATE `number` SET `tovarnik` = '{$id}'"); // Уменьшаем колличество товара на складе и пишим чек в базу $select_koltov_from_tezak = $connect_db->query("SELECT * FROM `tezak` WHERE `user` = '{$user}'"); while ($fetch_koltov_from_tezak = $select_koltov_from_tezak->fetch_assoc()) { $idtov_zak = $fetch_koltov_from_tezak['idtov']; $koltov_zak = $fetch_koltov_from_tezak['kol']; $koltov_garan = $fetch_koltov_from_tezak['garan']; $koltov_sn = $fetch_koltov_from_tezak['sn']; // Записываем чек в базу $add_chek = $connect_db->prepare("INSERT INTO `cheki` (`number`, `idtov`, `kol`, `garan`, `sn`, `user`, `akt`, `who`) VALUE (?,?,?,?,?,?,?,?)");
public function pricelong($value) { $value = round($value, 2); return num2strL($value) . ' (' . num2str($value) . ')'; }
$print_str = str_replace('%pre_month%', $months[date('F', strtotime("-1 months"))], $print_str); $print_str = str_replace('%current_month%', $months[date('F')], $print_str); $print_str = str_replace('%next_month%', $months[date('F', strtotime("+1 months"))], $print_str); return $print_str; } // Составляем полный текст основания РКО имея только пконечный ID if (isset($_POST['get_reason_text']) && $_POST['get_reason_text'] != '') { echo get_full_rko_template_text($_POST['get_reason_text']); } // Для рекурсивной обработки информации по родителям и детям дерева, напишем специальную функцию; // Получаем шаблон текста для основания рко; if (isset($_POST['get_rko_template']) && $_POST['get_rko_template'] != '') { } // Получение суммы прописью; if (isset($_POST['get_sum_str']) && $_POST['get_sum_str'] != '') { echo num2str($_POST['get_sum_str']); } // Различные типы поисков по разным справочникам; if (isset($_POST['find_client']) && $_POST['find_client'] != '') { //$sql = "select `code`, concat(`fam`, ' ', `name`, ' ', `g_name`) as `name`, `phone_m` as `phone` from `kontr` where concat(`fam`, ' ', `name`, ' ', `g_name`, ' ', `phone_m`) like '%".$_POST['find_client']."%' order by `fam` asc"; $sql = "select `code`, '' as `numm`, concat(`fam`, ' ', `name`, ' ', `g_name`) as `name`, `phone_m` as `phone`, '' as `sum`, 'Клиент / Сотрудник' as `doc_type` from `kontr` where concat(`fam`, ' ', `name`, ' ', `g_name`, ' ', `phone_m`) like '%" . $_POST['find_client'] . "%' order by `name` asc"; write_log($sql, 'pko'); $peoples_array = $db->all($sql); $sql = "select '' as `code`, `numm`, concat(`fam_z`, ' ', `name_z`, ' ', `otch_z`) as `name`, `tel1` as `phone`, `summa` as `sum`, 'Заказ' as `doc_type` from `remont` where `numm` like '%" . $_POST['find_client'] . "%' order by `name` asc"; write_log($sql, 'pko'); $orders_array = $db->all($sql); $sql = "select `code`, '' as `numm`, `primech` as `name`, '' as `phone`, `summ` as `sum`, 'ПКО' as `doc_type` from `kassa` where `type_m` in (0, 3) and (`code` like '%" . $_POST['find_client'] . "%' or `primech` like '%" . $_POST['find_client'] . "%') order by `name` asc"; write_log($sql, 'pko'); $money_array = $db->all($sql); // Выводим шапку таблицы; $html = '<br>';