alert('حدث خطا')"; } } else { echo ""; } $Next = date('Y-m-d', strtotime('+1 day', strtotime($today))); $Previous = date('Y-m-d', strtotime('-1 day', strtotime($today))); $Day = date('D', strtotime($today)); function Day_ar() { global $Day; $find = array("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri"); $replace = array("السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة"); $ar_day_format = $Day; $Day_ar = str_replace($find, $replace, $ar_day_format); return $Day_ar; } function Today_ar() { global $today; $Today_ar = date('d-m-Y', strtotime($today)); return $Today_ar; } $error = 0; $data = array(); $get_invoices_sql = mysqli_query($db, "SELECT `user`.`name`, `branch`.`branch_name` FROM `user` INNER JOIN `emplyee` ON `user`.`emplyee_id` = `emplyee`.`id` INNER JOIN `branch` ON `emplyee`.`branch_id` = `branch`.`id` WHERE `user`.`id` = $user_id "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { $data['info']['name'] = $get_invoices['name']; $data['info']['branch'] = $get_invoices['branch_name']; } $get_invoices_sql = mysqli_query($db, "SELECT `branch`.`id`, `branch`.`branch_name` FROM `branch` WHERE `branch`.`id` <> 1 "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { $data['branchs'][$get_invoices['id']] = array( 'branch_name' => $get_invoices['branch_name'], 'inv_d' => array(), 'bond_d' => array(), 'back_d' => array(), 'bond_back_d' => array(), ); } foreach ($data['branchs'] as $key => $value) { $get_invoices_sql = mysqli_query($db, "SELECT `invoices`.`number_style`, `invoices_details_has_how_pay`.`pay`, `invoices_details_has_how_pay`.`how_pay_id`,`invoices_details`.`invoices_status_id` 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` WHERE `invoices_details_has_how_pay`.`user_id` = $user_id AND ((`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` = $key "); if (mysqli_num_rows($get_invoices_sql) > 0) { while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { switch ($get_invoices['invoices_status_id']) { case '1': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['inv_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '2': $data['branchs'][$key]['inv_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['inv_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; break; case '6': case '7': case '8': case '9': $data['branchs'][$key]['inv_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; default: $error++; break; } break; case '2': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['inv_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '2': $data['branchs'][$key]['inv_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['inv_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; break; case '6': case '7': case '8': case '9': $data['branchs'][$key]['inv_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; default: $error++; break; } break; case '3': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] -= $get_invoices['pay']; $data['totals']['revenue'] -= $get_invoices['pay']; break; case '2': $data['branchs'][$key]['back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] -= $get_invoices['pay']; $data['totals']['revenue'] -= $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] -= $get_invoices['pay']; break; case '5': $data['branchs'][$key]['back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['inv_total'] -= $get_invoices['pay']; break; default: $error++; break; } break; default: $error++; break; } } } $get_invoices_sql = mysqli_query($db, "SELECT `bonds`.`number_style`, `bonds_details_has_how_pay`.`pay`, `bonds_details_has_how_pay`.`how_pay_id`, `bonds_details`.`bonds_status_id` FROM `bonds_details_has_how_pay` INNER JOIN `bonds_details` ON `bonds_details_has_how_pay`.`bonds_details_id` = `bonds_details`.`id` INNER JOIN `bonds` ON `bonds_details`.`bonds_id` = `bonds`.`id` WHERE `bonds_details_has_how_pay`.`user_id` = $user_id AND ((`bonds_details_has_how_pay`.`date_time` LIKE '$today%' AND `bonds_details_has_how_pay`.`date_time` >= '$today 03:00:00') OR (`bonds_details_has_how_pay`.`date_time` LIKE '$Next%' AND `bonds_details_has_how_pay`.`date_time` < '$Next 03:00:00')) AND `bonds_details`.`branch_id` = $key "); if (mysqli_num_rows($get_invoices_sql) > 0) { while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { switch ($get_invoices['bonds_status_id']) { case '1': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['bond_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '2': $data['branchs'][$key]['bond_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['bond_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; break; case '6': case '7': case '8': case '9': $data['branchs'][$key]['bond_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; default: $error++; break; } break; case '2': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['bond_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '2': $data['branchs'][$key]['bond_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['bond_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; break; case '6': case '7': case '8': case '9': $data['branchs'][$key]['bond_cre'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] += $get_invoices['pay']; $data['totals']['revenue'] += $get_invoices['pay']; break; default: $error++; break; } break; case '3': switch ($get_invoices['how_pay_id']) { case '1': $data['branchs'][$key]['bond_back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] -= $get_invoices['pay']; $data['totals']['revenue'] -= $get_invoices['pay']; break; case '2': $data['branchs'][$key]['bond_back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] -= $get_invoices['pay']; $data['totals']['revenue'] -= $get_invoices['pay']; break; case '3': case '4': $data['branchs'][$key]['bond_back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] -= $get_invoices['pay']; break; case '5': $data['branchs'][$key]['bond_back_d'][$get_invoices['number_style']]['payments'][$get_invoices['how_pay_id']] = $get_invoices['pay']; $data['totals']['bond_total'] -= $get_invoices['pay']; break; default: $error++; break; } break; default: $error++; break; } } } } ?>
| معلومات الموظف | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| رقم الموظف | الاسم | الفرع الاساسي | الفواتير | أرصدة دائنة - عملاء | إجمالي المتحصلات | |||||
| =$data['info']['name']?> | =$data['info']['branch']?> | =!empty($data['totals']['inv_total'])? $data['totals']['inv_total']: 0?> | =!empty($data['totals']['bond_total'])? $data['totals']['bond_total']: 0?> | =!empty($data['totals']['revenue'])? $data['totals']['revenue']: 0?> | ||||||
| =$data['branchs'][$key]['branch_name']?> | ||||||||||
| الفواتير | ||||||||||
| رقم الفاتورة | الصادر | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| ساب 56001 | الراجحي 66443 | الاهلي 00100 | الانماء 06000 | سداد اونلاين | ||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | =$temp_7?> | =$temp_8?> | =$temp_9?> | |
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | =$t7?> | =$t8?> | =$t9?> | |
| اشعارات مدين | ||||||||||
| لرقم الفاتورة | الصادر | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| ساب 56001 | الراجحي 66443 | الاهلي 00100 | الانماء 06000 | |||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | =$temp_7?> | =$temp_8?> | =$temp_9?> | |
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | =$t7?> | =$t8?> | =$t9?> | |
| مرتجعات | ||||||||||
| رقم الفاتورة | المرتجع | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | ||||
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | ||||
| الأرصدة | ||||||||||
| رقم السند | الصادر | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| ساب 56001 | الراجحي 66443 | الاهلي 00100 | الانماء 06000 | |||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | =$temp_7?> | =$temp_8?> | =$temp_9?> | |
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | =$t7?> | =$t8?> | =$t9?> | |
| اضافات للارصدة | ||||||||||
| لرقم السند | الصادر | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| ساب 56001 | الراجحي 66443 | الاهلي 00100 | الانماء 06000 | |||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | =$temp_7?> | =$temp_8?> | =$temp_9?> | |
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | =$t7?> | =$t8?> | =$t9?> | |
| مرتجعات ارصدة | ||||||||||
| رقم السند | المرتجع | الاجمالي | ||||||||
| كاش | شبكة | تحويل | رصيد | اخرى | ||||||
| =$key2?> | =$temp_1?> | =$temp_2?> | =$temp_3?> | =$temp_4?> | =$temp_5?> | =$temp_6?> | ||||
| المجموع | =$t1?> | =$t2?> | =$t3?> | =$t4?> | =$t5?> | =$t6?> | ||||