' . $c_r_id; } $branch_id = $_GET['b']; if (!empty($_GET['b'])) { $branch_id = $_GET['b']; if (!is_numeric($branch_id)) { $branch_id = 1; } } else { $branch_id = 1; } if (!empty($_GET['f'])) { if (is_numeric($c_r_id) && $_GET['f'] == 1) { $branch_id = 1; } } $branch_sql = '=' . $branch_id; if ($branch_id == 1) { $branch_sql = '<>' . $branch_id; } $error = 0; $data = array(); function __getLength($value) { return strlen($value); } function __toHex($value) { return pack("H*", sprintf("%02X", $value)); } function __toString($__tag, $__value, $__length) { $value = (string) $__value; return __toHex($__tag) . __toHex($__length) . $value; } function __getTLV($dataToEncode) { $__TLVS = ''; for ($i = 0; $i < count($dataToEncode); $i++) { $__tag = $dataToEncode[$i][0]; $__value = $dataToEncode[$i][1]; $__length = __getLength($__value); $__TLVS .= __toString($__tag, $__value, $__length); } return $__TLVS; } $get_invoices_sql = mysqli_query( $db, "SELECT `invoices`.`id` AS `i_id`, `invoices`.`date_time`, `invoices_details`.`date_time` AS `c_date_time`, `invoices`.`number_style`, `invoices_details`.`pay`, `book`.`id` AS `b_id`, `invoices_details`.`id` AS `id_id`, `services`.`name`, `services`.`price` FROM `invoices_details_has_how_pay` INNER JOIN `invoices_details` ON `invoices_details_has_how_pay`.`invoices_details_id` = `invoices_details`.`id` INNER JOIN `invoices` ON `invoices_details`.`invoices_id` = `invoices`.`id` INNER JOIN `invoices_has_book` ON `invoices_has_book`.`invoices_id` = `invoices`.`id` INNER JOIN `book` ON `invoices_has_book`.`book_id` = `book`.`id` INNER JOIN `book_details` AS `bd` ON `bd`.`book_id` = `book`.`id` INNER JOIN `services` ON `bd`.`services_id` = `services`.`id` JOIN ( SELECT `book_id`, MAX(`id`) AS `max_id` FROM `book_details` GROUP BY `book_id` ) `t1_max` ON `bd`.`book_id` = `t1_max`.`book_id` AND `bd`.`id` = `t1_max`.`max_id` WHERE ((`invoices_details_has_how_pay`.`date_time` LIKE '$today%' AND `invoices_details_has_how_pay`.`date_time` >= '$today 03:00:00') OR (`invoices_details_has_how_pay`.`date_time` LIKE '$Next%' AND `invoices_details_has_how_pay`.`date_time` < '$Next 03:00:00')) AND `invoices_details`.`branch_id` $branch_sql AND `invoices_details`.`invoices_status_id` = 3 " ); if (mysqli_num_rows($get_invoices_sql) > 0) { while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { $QR_dataToEncode = [ [1, $campany_info['company_name']], [2, $campany_info['vat_number']], [3, date("Y-m-d\TH:i:s", strtotime($get_invoices['date_time']))], [4, round($get_invoices['pay'], 2)], [5, round((($get_invoices['pay'] / 1.15) * $vat / 100), 2)] ]; $QR___TLV = __getTLV($QR_dataToEncode); $QR___QR = base64_encode($QR___TLV); $QR_data = $QR___QR; $QR_options = new QROptions([ 'version' => 8, 'outputType' => QRCode::OUTPUT_IMAGE_PNG, 'eccLevel' => QRCode::ECC_L, 'scale' => 3, 'imageBase64' => true, ]); $QR_qrcode = new QRCode($QR_options); $QR_qrCodeBase64 = $QR_qrcode->render($QR_data); if (array_key_exists($get_invoices['i_id'], $data)) { $data[$get_invoices['i_id']]['books'][$get_invoices['b_id']] = array( 's_name' => $get_invoices['name'], 's_count' => 1, 's_price' => round($get_invoices['pay']/1.15, 2), 's_price_with_s_count' => round($get_invoices['pay']/1.15, 2), 'total_with_des' => round($get_invoices['pay']/1.15, 2), 'vat_rate' => 15, 'vat' => round((($get_invoices['pay']/1.15) * 0.15), 2), 'total_with_vat' => round((($get_invoices['pay']/1.15) * 0.15) + ($get_invoices['pay']/1.15), 2), ); } else { $data[$get_invoices['i_id']] = array( 'number_style' => $get_invoices['number_style'], 'date_time' => $get_invoices['c_date_time'], 'books' => array( $get_invoices['b_id'] => array( 's_name' => $get_invoices['name'], 's_count' => 1, 's_price' => round($get_invoices['pay']/1.15, 2), 's_price_with_s_count' => round($get_invoices['pay']/1.15, 2), 'vat_rate' => 15, 'vat' => round((($get_invoices['pay']/1.15) * 0.15), 2), 'total_with_vat' => round((($get_invoices['pay']/1.15) * 0.15) + ($get_invoices['pay']/1.15), 2), ) ), 'tr_vat_name' => '', 'tr_vat_number' => '', 'tr_vat_adress' => '', 'tr_card_id' => '', 'QR' => $QR_qrCodeBase64, ); } } } ?>


-
+
$value) { ?> $value2) { ?>
رقم الاشعار الدائن تاريخ الاشعار رقم الفاتورة الاصلية اسم الخدمة الكمية سعر الخدمة القيمة معدل الضريبة قيمة الضريبة القيمة بعد الضريبة اسم العميل المسجل بالضريبة رقم التسجيل الضريبي العنوان رقم الهوية للسعودي الباركود
% طباعة الاشعار الدائن