Merge pull request #367 from gerandonk/Development
add voucher date created and print by date
This commit is contained in:
commit
27c736fa69
@ -213,6 +213,7 @@ CREATE TABLE `tbl_voucher` (
|
||||
`code` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`user` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`status` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`used_date` DATETIME NULL DEFAULT NULL,
|
||||
`generated_by` int NOT NULL DEFAULT '0' COMMENT 'id admin'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
@ -552,6 +552,7 @@ switch ($action) {
|
||||
$pagebreak = _post('pagebreak');
|
||||
$limit = _post('limit');
|
||||
$vpl = _post('vpl');
|
||||
$selected_datetime = _post('selected_datetime');
|
||||
if (empty($vpl)) {
|
||||
$vpl = 3;
|
||||
}
|
||||
@ -616,6 +617,11 @@ switch ($action) {
|
||||
$v = $v->where_in('generated_by', $sales)->find_many();
|
||||
$vc = $vc->where_in('generated_by', $sales)->count();
|
||||
}
|
||||
if (!empty($selected_datetime)) {
|
||||
$v = ORM::for_table('tbl_voucher')
|
||||
->where('created_at', $selected_datetime)
|
||||
->find_many();
|
||||
}
|
||||
$template = file_get_contents("pages/Voucher.html");
|
||||
$template = str_replace('[[company_name]]', $config['CompanyName'], $template);
|
||||
|
||||
@ -628,6 +634,14 @@ switch ($action) {
|
||||
$ui->assign('plans', $plans);
|
||||
$ui->assign('limit', $limit);
|
||||
$ui->assign('planid', $planid);
|
||||
|
||||
$createdate = ORM::for_table('tbl_voucher')
|
||||
->select_expr('DISTINCT created_at', 'created_datetime')
|
||||
->where_not_equal('created_at', '0')
|
||||
->order_by_desc('created_at')
|
||||
->find_array();
|
||||
|
||||
$ui->assign('createdate', $createdate);
|
||||
|
||||
$voucher = [];
|
||||
$n = 1;
|
||||
@ -644,6 +658,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('voucher', $voucher);
|
||||
$ui->assign('vc', $vc);
|
||||
$ui->assign('selected_datetime', $selected_datetime);
|
||||
|
||||
//for counting pagebreak
|
||||
$ui->assign('jml', 0);
|
||||
|
@ -181,5 +181,8 @@
|
||||
],
|
||||
"2024.12.16": [
|
||||
"CREATE TABLE `tbl_coupons` ( `id` INT AUTO_INCREMENT PRIMARY KEY, `code` VARCHAR(50) NOT NULL UNIQUE, `type` ENUM('fixed', 'percent') NOT NULL, `value` DECIMAL(10,2) NOT NULL, `description` TEXT NOT NULL, `max_usage` INT NOT NULL DEFAULT 1,`usage_count` INT NOT NULL DEFAULT 0,`status` ENUM('active', 'inactive') NOT NULL, `min_order_amount` DECIMAL(10,2) NOT NULL, `max_discount_amount` DECIMAL(10,2) NOT NULL, `start_date` DATE NOT NULL,`end_date` DATE NOT NULL, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);"
|
||||
],
|
||||
"2024.12.20": [
|
||||
"ALTER TABLE `tbl_voucher` ADD `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `status`;"
|
||||
]
|
||||
}
|
@ -75,6 +75,14 @@
|
||||
<option value="{$plan['id']}" {if $plan['id']==$planid}selected{/if}>{$plan['name_plan']}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select></td>
|
||||
<td>Date <select id="selected_datetime" name="selected_datetime" style="width:50px">
|
||||
<option value="">--all--</option>
|
||||
{foreach $createdate as $date}
|
||||
<option value="{$date.created_datetime}" {if $date.created_datetime eq $selected_datetime}selected{/if}>
|
||||
{$date.created_datetime}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select></td>
|
||||
<td><button type="submit">submit</button></td>
|
||||
</tr>
|
||||
|
@ -97,6 +97,7 @@
|
||||
<th>{Lang::T('Code Voucher')}</th>
|
||||
<th>{Lang::T('Status Voucher')}</th>
|
||||
<th>{Lang::T('Customer')}</th>
|
||||
<th>{Lang::T('Create Date')}</th>
|
||||
<th>{Lang::T('Used Date')}</th>
|
||||
<th>{Lang::T('Generated By')}</th>
|
||||
<th>{Lang::T('Manage')}</th>
|
||||
@ -119,6 +120,7 @@
|
||||
<td>{if $ds['user'] eq '0'} -
|
||||
{else}<a href="{$_url}customers/viewu/{$ds['user']}">{$ds['user']}</a>
|
||||
{/if}</td>
|
||||
<td>{if $ds['created_at']}{Lang::dateTimeFormat($ds['created_at'])}{/if}</td>
|
||||
<td>{if $ds['used_date']}{Lang::dateTimeFormat($ds['used_date'])}{/if}</td>
|
||||
<td>{if $ds['generated_by']}
|
||||
<a
|
||||
|
Loading…
x
Reference in New Issue
Block a user