Enhancements and Fixes
Added Vouchers Printing Per Page option, default is 36 for A4 papers. Fix voucher printing date showing time and seconds (its annoying), replaced with group by days created, and also added number of vouchers created on each days to make it more unique and classy
This commit is contained in:
parent
b1e145f0dc
commit
cfe0a14f31
@ -595,6 +595,17 @@ switch ($action) {
|
||||
->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||
->where('tbl_voucher.status', '0')
|
||||
->where_gt('tbl_voucher.id', $from_id);
|
||||
} else if ($from_id > 0 && $planid == 0 && $selected_datetime != '') {
|
||||
$v = ORM::for_table('tbl_plans')
|
||||
->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||
->where('tbl_voucher.status', '0')
|
||||
->where_raw("DATE(created_at) = ?", [$selected_datetime])
|
||||
->where_gt('tbl_voucher.id', $from_id)
|
||||
->limit($limit);
|
||||
$vc = ORM::for_table('tbl_plans')
|
||||
->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||
->where('tbl_voucher.status', '0')
|
||||
->where_gt('tbl_voucher.id', $from_id);
|
||||
} else {
|
||||
$v = ORM::for_table('tbl_plans')
|
||||
->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||
@ -617,11 +628,7 @@ 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);
|
||||
|
||||
@ -636,9 +643,14 @@ switch ($action) {
|
||||
$ui->assign('planid', $planid);
|
||||
|
||||
$createdate = ORM::for_table('tbl_voucher')
|
||||
->select_expr('DISTINCT created_at', 'created_datetime')
|
||||
->select_expr(
|
||||
"CASE WHEN DATE(created_at) = CURDATE() THEN 'Today' ELSE DATE(created_at) END",
|
||||
'created_datetime'
|
||||
)
|
||||
->where_not_equal('created_at', '0')
|
||||
->order_by_desc('created_at')
|
||||
->select_expr('COUNT(*)', 'voucher_count')
|
||||
->group_by('created_datetime')
|
||||
->order_by_desc('created_datetime')
|
||||
->find_array();
|
||||
|
||||
$ui->assign('createdate', $createdate);
|
||||
@ -678,6 +690,7 @@ switch ($action) {
|
||||
$numbervoucher = _post('numbervoucher');
|
||||
$lengthcode = _post('lengthcode');
|
||||
$printNow = _post('print_now', 'no');
|
||||
$voucherPerPage = _post('voucher_per_page', '36');
|
||||
|
||||
$msg = '';
|
||||
if (empty($type) || empty($plan) || empty($server) || empty($numbervoucher) || empty($lengthcode)) {
|
||||
@ -768,7 +781,7 @@ switch ($action) {
|
||||
$ui->assign('jml', 0);
|
||||
$ui->assign('from_id', 0);
|
||||
$ui->assign('vpl', '3');
|
||||
$ui->assign('pagebreak', '12');
|
||||
$ui->assign('pagebreak', $voucherPerPage);
|
||||
$ui->display('print-voucher.tpl');
|
||||
}
|
||||
|
||||
|
@ -930,5 +930,15 @@
|
||||
"Send_yours_balance___": "Send yours balance ? ",
|
||||
"Cards": "Cards",
|
||||
"CRM": "CRM",
|
||||
"Coupons": "Coupons"
|
||||
"Coupons": "Coupons",
|
||||
"Voucher_Cards": "Voucher Cards",
|
||||
"Create_Date": "Create Date",
|
||||
"Delete_Selected": "Delete Selected",
|
||||
"Print_Now": "Print Now",
|
||||
"Vouchers_Per_Page": "Vouchers Per Page",
|
||||
"Save_as_template": "Save as template",
|
||||
"Template_Name": "Template Name",
|
||||
"Voucher_Code": "Voucher Code",
|
||||
"Voucher_Package": "Voucher Package",
|
||||
"Counter": "Counter"
|
||||
}
|
@ -9,14 +9,14 @@
|
||||
.ukuran {
|
||||
size: A4;
|
||||
}
|
||||
|
||||
|
||||
body,
|
||||
td,
|
||||
th {
|
||||
font-size: 12px;
|
||||
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
page[size="A4"] {
|
||||
background: white;
|
||||
width: 21cm;
|
||||
@ -24,32 +24,28 @@
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 0.5cm;
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media print {
|
||||
body {
|
||||
size: auto;
|
||||
margin: 0;
|
||||
box-shadow: 0;
|
||||
}
|
||||
|
||||
page[size="A4"] {
|
||||
margin: 0;
|
||||
size: auto;
|
||||
box-shadow: 0;
|
||||
}
|
||||
|
||||
.page-break {
|
||||
display: block;
|
||||
page-break-before: always;
|
||||
}
|
||||
|
||||
.no-print,
|
||||
.no-print * {
|
||||
display: none !important;
|
||||
@ -65,10 +61,10 @@
|
||||
<tr>
|
||||
<td>From ID > <input type="text" name="from_id" style="width:40px" value="{$from_id}"> limit
|
||||
<input type="text" name="limit" style="width:40px" value="{$limit}"></td>
|
||||
<td>Voucher PerLine <input type="text" style="width:40px" name="vpl" value="{$vpl}">
|
||||
vouchers</td>
|
||||
<td>PageBreak after <input type="text" style="width:40px" name="pagebreak" value="{$pagebreak}">
|
||||
vouchers</td>
|
||||
<td>Voucher PerLine <input type="text" style="width:40px" name="vpl" value="{$vpl}"> vouchers
|
||||
</td>
|
||||
<td>PageBreak after <input type="text" style="width:40px" name="pagebreak" value="{$pagebreak}"> vouchers
|
||||
</td>
|
||||
<td>Plans <select id="plan_id" name="planid" style="width:50px">
|
||||
<option value="0">--all--</option>
|
||||
{foreach $plans as $plan}
|
||||
@ -76,11 +72,11 @@
|
||||
</option>
|
||||
{/foreach}
|
||||
</select></td>
|
||||
<td>Date <select id="selected_datetime" name="selected_datetime" style="width:50px">
|
||||
<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}
|
||||
{$date.created_datetime} ({$date.voucher_count})
|
||||
</option>
|
||||
{/foreach}
|
||||
</select></td>
|
||||
@ -88,47 +84,29 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<center><button type="button" onclick="window.print()"
|
||||
class="btn btn-default btn-sm no-print">{Lang::T('Click Here to Print')}</button><br>
|
||||
{Lang::T('Print side by side, it will easy to cut')}<br>
|
||||
show {$v|@count} vouchers from {$vc} vouchers<br>
|
||||
from ID {$v[0]['id']} limit {$limit} vouchers
|
||||
<center><button type="button" onclick="window.print()" class="btn btn-default btn-sm no-print">{Lang::T('Click Here to Print')}</button><br> {Lang::T('Print side by side, it will easy to cut')}<br> show {$v|@count} vouchers from {$vc} vouchers<br> from ID {$v[0]['id']} limit {$limit} vouchers
|
||||
</center>
|
||||
</form>
|
||||
<div id="printable" align="center">
|
||||
<hr>
|
||||
{$n = 1}
|
||||
{foreach $voucher as $vs}
|
||||
{$jml = $jml + 1}
|
||||
{if $n == 1}
|
||||
<table>
|
||||
<tr>
|
||||
{/if}
|
||||
<td>{$vs}</td>
|
||||
{if $n == $vpl}
|
||||
</table>
|
||||
{$n = 1}
|
||||
{else}
|
||||
{$n = $n + 1}
|
||||
{/if}
|
||||
|
||||
|
||||
{if $jml == $pagebreak}
|
||||
{$jml = 0}
|
||||
<!-- pageBreak -->
|
||||
<div class="page-break">
|
||||
<div class="no-print" style="background-color: #E91E63; color:#FFF;" align="center">-- pageBreak --
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
<hr> {$n = 1} {foreach $voucher as $vs} {$jml = $jml + 1} {if $n == 1}
|
||||
<table>
|
||||
<tr>
|
||||
{/if}
|
||||
<td>{$vs}</td>
|
||||
{if $n == $vpl}
|
||||
</table>
|
||||
{$n = 1} {else} {$n = $n + 1} {/if} {if $jml == $pagebreak} {$jml = 0}
|
||||
<!-- pageBreak -->
|
||||
<div class="page-break">
|
||||
<div class="no-print" style="background-color: #E91E63; color:#FFF;" align="center">-- pageBreak --
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
{/if} {/foreach}
|
||||
</div>
|
||||
</page>
|
||||
<script src="ui/ui/scripts/jquery.min.js"></script>
|
||||
{if isset($xfooter)}
|
||||
{$xfooter}
|
||||
{/if}
|
||||
{if isset($xfooter)} {$xfooter} {/if}
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
// initiate layout and plugins
|
||||
|
@ -41,16 +41,15 @@
|
||||
<label class="col-md-2 control-label">{Lang::T('Voucher Format')}</label>
|
||||
<div class="col-md-6">
|
||||
<select name="voucher_format" id="voucher_format" class="form-control">
|
||||
<option value="numbers" {if $_c['voucher_format'] == 'numbers'}selected="selected"
|
||||
{/if}>
|
||||
<option value="numbers" {if $_c['voucher_format']=='numbers' }selected="selected" {/if}>
|
||||
Numbers
|
||||
</option>
|
||||
<option value="up" {if $_c['voucher_format'] == 'up'}selected="selected" {/if}>UPPERCASE
|
||||
<option value="up" {if $_c['voucher_format']=='up' }selected="selected" {/if}>UPPERCASE
|
||||
</option>
|
||||
<option value="low" {if $_c['voucher_format'] == 'low'}selected="selected" {/if}>
|
||||
<option value="low" {if $_c['voucher_format']=='low' }selected="selected" {/if}>
|
||||
lowercase
|
||||
</option>
|
||||
<option value="rand" {if $_c['voucher_format'] == 'rand'}selected="selected" {/if}>
|
||||
<option value="rand" {if $_c['voucher_format']=='rand' }selected="selected" {/if}>
|
||||
RaNdoM
|
||||
</option>
|
||||
</select>
|
||||
@ -60,8 +59,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Voucher Prefix')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" name="prefix" placeholder="NUX-"
|
||||
value="{$_c['voucher_prefix']}">
|
||||
<input type="text" class="form-control" name="prefix" placeholder="NUX-" value="{$_c['voucher_prefix']}">
|
||||
</div>
|
||||
<p class="help-block col-md-4">NUX-VoUCHeRCOdE</p>
|
||||
</div>
|
||||
@ -76,9 +74,19 @@
|
||||
<label for="inputSkills" class="col-sm-2 control-label">{Lang::T('Print Now')}</label>
|
||||
|
||||
<div class="col-sm-10">
|
||||
<input type="checkbox" id="print_now" name="print_now" class="iCheck" value="yes">
|
||||
<input type="checkbox" id="print_now" name="print_now" class="iCheck" value="yes" onclick="showVouchersPerPage()">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="printers" style="display:none;">
|
||||
<label class="col-md-2 control-label">{Lang::T('Vouchers Per Page')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" id="voucher-print" class="form-control" name="voucher_per_page" value="36" placeholder="Vouchers Per Page (default 36)">
|
||||
</div>
|
||||
<p class="help-block col-md-4">
|
||||
{Lang::T('Vouchers Per Page')} (default 36)
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success" onclick="return ask(this, 'Continue the Voucher creation process?')" type="submit">{Lang::T('Generate')}</button>
|
||||
@ -91,4 +99,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
<!-- /voucher-add -->
|
||||
|
||||
<script>
|
||||
function showVouchersPerPage() {
|
||||
var printNow = document.getElementById('print_now');
|
||||
var printers = document.getElementById('printers');
|
||||
var voucherPrint = document.getElementById('voucher-print');
|
||||
|
||||
voucherPrint.required = false;
|
||||
if (printNow.checked) {
|
||||
printers.style.display = 'block';
|
||||
voucherPrint.required = true;
|
||||
} else {
|
||||
printers.style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
Loading…
x
Reference in New Issue
Block a user