68 lines
3.8 KiB
PHP
Executable File
68 lines
3.8 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
|
|
$frist_day = date('2022-07-06');
|
|
$last_day = date('2023-01-25');
|
|
// $last_day = date("Y-m-t", strtotime($frist_day));
|
|
$next_day = $frist_day;
|
|
|
|
while ($next_day <= $last_day) {
|
|
$temp_next_day = date('Y-m-d', strtotime('+1 day', strtotime($next_day)));
|
|
// mysqli_query(
|
|
// $db,
|
|
// "INSERT INTO `r_month_user_invoices`(`filter`, `date`,`branch_id`, `total`, `invoices_status_id`, `how_pay_id`, `date_time`, `user_id`, `activation_id`)
|
|
// SELECT
|
|
// CASE
|
|
// WHEN (invoices_details_has_how_pay.date_time >= concat(DATE(invoices_details_has_how_pay.date_time),' 03:00:00')) THEN DATE(invoices_details_has_how_pay.date_time)
|
|
// WHEN (invoices_details_has_how_pay.date_time < concat(DATE_ADD(DATE(invoices_details_has_how_pay.date_time), INTERVAL +1 DAY),' 03:00:00')) THEN concat(DATE_ADD(DATE(invoices_details_has_how_pay.date_time), INTERVAL -1 DAY))
|
|
// ELSE 'false'
|
|
// END AS `filter`,
|
|
// DATE(invoices_details_has_how_pay.date_time) AS `date`,
|
|
// invoices_details.branch_id,
|
|
// SUM(invoices_details_has_how_pay.pay) AS total,
|
|
// invoices_details.invoices_status_id,
|
|
// invoices_details_has_how_pay.how_pay_id,
|
|
// '$date_time',
|
|
// '1',
|
|
// '1'
|
|
|
|
// FROM invoices_details_has_how_pay
|
|
// INNER JOIN invoices_details ON invoices_details_has_how_pay.invoices_details_id = invoices_details.id
|
|
// WHERE ((`invoices_details_has_how_pay`.`date_time` LIKE '$next_day%' AND `invoices_details_has_how_pay`.`date_time` >= '$next_day 03:00:00') OR (`invoices_details_has_how_pay`.`date_time` LIKE '$temp_next_day%' AND `invoices_details_has_how_pay`.`date_time` < '$temp_next_day 03:00:00'))
|
|
// GROUP BY `date`,
|
|
// invoices_details.branch_id,
|
|
// `invoices_details`.`invoices_status_id`,
|
|
// `invoices_details_has_how_pay`.`how_pay_id`"
|
|
// );
|
|
|
|
// mysqli_query(
|
|
// $db,
|
|
// "INSERT INTO `r_month_user_bonds`(`filter`, `date`,`branch_id`, `total`, `bonds_status_id`, `how_pay_id`, `date_time`, `user_id`, `activation_id`)
|
|
// SELECT
|
|
// CASE
|
|
// WHEN (bonds_details_has_how_pay.date_time >= concat(DATE(bonds_details_has_how_pay.date_time),' 03:00:00')) THEN DATE(bonds_details_has_how_pay.date_time)
|
|
// WHEN (bonds_details_has_how_pay.date_time < concat(DATE_ADD(DATE(bonds_details_has_how_pay.date_time), INTERVAL +1 DAY),' 03:00:00')) THEN concat(DATE_ADD(DATE(bonds_details_has_how_pay.date_time), INTERVAL -1 DAY))
|
|
// ELSE 'false'
|
|
// END AS `filter`,
|
|
// DATE(bonds_details_has_how_pay.date_time) AS `date`,
|
|
// bonds_details.branch_id,
|
|
// SUM(bonds_details_has_how_pay.pay) AS total,
|
|
// bonds_details.bonds_status_id,
|
|
// bonds_details_has_how_pay.how_pay_id,
|
|
// '$date_time',
|
|
// '1',
|
|
// '1'
|
|
|
|
// FROM bonds_details_has_how_pay
|
|
// INNER JOIN bonds_details ON bonds_details_has_how_pay.bonds_details_id = bonds_details.id
|
|
// WHERE ((`bonds_details_has_how_pay`.`date_time` LIKE '$next_day%' AND `bonds_details_has_how_pay`.`date_time` >= '$next_day 03:00:00') OR (`bonds_details_has_how_pay`.`date_time` LIKE '$temp_next_day%' AND `bonds_details_has_how_pay`.`date_time` < '$temp_next_day 03:00:00'))
|
|
// GROUP BY `date`,
|
|
// bonds_details.branch_id,
|
|
// `bonds_details`.`bonds_status_id`,
|
|
// `bonds_details_has_how_pay`.`how_pay_id`"
|
|
// );
|
|
|
|
$next_day = date('Y-m-d', strtotime('+1 day', strtotime($next_day)));
|
|
}
|
|
|