'.$branch_id; } $data = array( 'totals' => array( 'inv' => 0, 'bonds' => 0, ) ); $get_invoices_sql = mysqli_query($db, "SELECT `filter`, `branch_id`, SUM(`total`) AS `total` FROM `r_bonds_int_dec_invoices` WHERE `branch_id` $branch_sql AND DATE_FORMAT(`filter`, '%Y-%m') < '$today' "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { $data['totals']['inv'] += $get_invoices['total']; } $get_invoices_sql = mysqli_query($db, "SELECT `filter`, `branch_id`, `total`, `bonds_status_id`, `how_pay_id` FROM `r_month_user_bonds` WHERE `branch_id` $branch_sql AND DATE_FORMAT(`filter`, '%Y-%m') < '$today' "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { switch ($get_invoices['bonds_status_id']) { case '1': case '2': switch ($get_invoices['how_pay_id']) { case '1': $data['totals']['bonds'] += $get_invoices['total']; break; case '2': $data['totals']['bonds'] += $get_invoices['total']; break; } break; case '3': switch ($get_invoices['how_pay_id']) { case '1': $data['totals']['bonds'] -= $get_invoices['total']; break; } break; case '4': echo""; break; } } $get_invoices_sql = mysqli_query($db, "SELECT `filter`, `total`, `invoices_status_id`, `how_pay_id` FROM `r_bonds_int_dec_invoices` WHERE DATE_FORMAT(`filter`, '%Y-%m') = '$today' AND `branch_id` $branch_sql "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { switch ($get_invoices['invoices_status_id']) { case '1': case '2': switch ($get_invoices['how_pay_id']) { case '3': case '4': $data['inv'][$get_invoices['filter']]['stuck'] += $get_invoices['total']; break; } break; case '3': switch ($get_invoices['how_pay_id']) { case '3': case '4': $data['back'][$get_invoices['filter']]['stuck'] += $get_invoices['total']; break; } break; case '4': echo""; break; } } $get_invoices_sql = mysqli_query($db, "SELECT `filter`, `total`, `bonds_status_id`, `how_pay_id` FROM `r_month_user_bonds` WHERE DATE_FORMAT(`filter`, '%Y-%m') = '$today' AND `branch_id` $branch_sql "); while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) { switch ($get_invoices['bonds_status_id']) { case '1': case '2': switch ($get_invoices['how_pay_id']) { case '1': $data['bonds'][$get_invoices['filter']]['cash'] += $get_invoices['total']; break; case '2': $data['bonds'][$get_invoices['filter']]['card'] += $get_invoices['total']; break; case '6': case '7': case '8': case '9': case '10': $data['bonds'][$get_invoices['filter']]['stuck'] += $get_invoices['total']; break; } break; case '3': switch ($get_invoices['how_pay_id']) { case '1': case '2': case '3': $data['bonds_back'][$get_invoices['filter']]['cash'] += $get_invoices['total']; break; case '4': $data['bonds'][$get_invoices['filter']]['stuck'] += $get_invoices['total']; break; case '5': $data['bonds_back'][$get_invoices['filter']]['stuck'] += $get_invoices['total']; break; } break; case '4': echo""; break; } } $totals = ($data['totals']['bonds'] - $data['totals']['inv']); ?>

إيرادات شهر

-
+
طلب التقرير
رصيد العملاء
التاريخ وارد صادر الرصيد