| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.ansachsongkhoe.net/public/js/ |
Upload File : |
$(document).ready(function() {
if ($('#dashboard_date_filter').length == 1) {
dateRangeSettings.startDate = moment();
dateRangeSettings.endDate = moment();
$('#dashboard_date_filter').daterangepicker(dateRangeSettings, function(start, end) {
$('#dashboard_date_filter span').html(
start.format(moment_date_format) + ' ~ ' + end.format(moment_date_format)
);
update_statistics(start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD'));
if ($('#quotation_table').length && $('#dashboard_location').length) {
quotation_datatable.ajax.reload();
}
});
update_statistics(moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD'));
}
$('#dashboard_location').change( function(e) {
var start = $('#dashboard_date_filter')
.data('daterangepicker')
.startDate.format('YYYY-MM-DD');
var end = $('#dashboard_date_filter')
.data('daterangepicker')
.endDate.format('YYYY-MM-DD');
update_statistics(start, end);
});
//atock alert datatables
var stock_alert_table = $('#stock_alert_table').DataTable({
processing: true,
serverSide: true,
ordering: false,
searching: false,
scrollY: "75vh",
scrollX: true,
scrollCollapse: true,
fixedHeader: false,
dom: 'Btirp',
ajax: '/home/product-stock-alert',
fnDrawCallback: function(oSettings) {
__currency_convert_recursively($('#stock_alert_table'));
},
});
//payment dues datatables
var purchase_payment_dues_table = $('#purchase_payment_dues_table').DataTable({
processing: true,
serverSide: true,
ordering: false,
searching: false,
scrollY: "75vh",
scrollX: true,
scrollCollapse: true,
fixedHeader: false,
dom: 'Btirp',
ajax: '/home/purchase-payment-dues',
fnDrawCallback: function(oSettings) {
__currency_convert_recursively($('#purchase_payment_dues_table'));
},
});
//Sales dues datatables
var sales_payment_dues_table = $('#sales_payment_dues_table').DataTable({
processing: true,
serverSide: true,
ordering: false,
searching: false,
scrollY: "75vh",
scrollX: true,
scrollCollapse: true,
fixedHeader: false,
dom: 'Btirp',
ajax: '/home/sales-payment-dues',
fnDrawCallback: function(oSettings) {
__currency_convert_recursively($('#sales_payment_dues_table'));
},
});
//Stock expiry report table
stock_expiry_alert_table = $('#stock_expiry_alert_table').DataTable({
processing: true,
serverSide: true,
searching: false,
scrollY: "75vh",
scrollX: true,
scrollCollapse: true,
fixedHeader: false,
dom: 'Btirp',
ajax: {
url: '/reports/stock-expiry',
data: function(d) {
d.exp_date_filter = $('#stock_expiry_alert_days').val();
},
},
order: [[3, 'asc']],
columns: [
{ data: 'product', name: 'p.name' },
{ data: 'location', name: 'l.name' },
{ data: 'stock_left', name: 'stock_left' },
{ data: 'exp_date', name: 'exp_date' },
],
fnDrawCallback: function(oSettings) {
__show_date_diff_for_human($('#stock_expiry_alert_table'));
__currency_convert_recursively($('#stock_expiry_alert_table'));
},
});
if ($('#quotation_table').length) {
quotation_datatable = $('#quotation_table').DataTable({
processing: true,
serverSide: true,
aaSorting: [[0, 'desc']],
"ajax": {
"url": '/sells/draft-dt?is_quotation=1',
"data": function ( d ) {
if ($('#dashboard_location').length > 0) {
d.location_id = $('#dashboard_location').val();
}
}
},
columnDefs: [ {
"targets": 4,
"orderable": false,
"searchable": false
} ],
columns: [
{ data: 'transaction_date', name: 'transaction_date' },
{ data: 'invoice_no', name: 'invoice_no'},
{ data: 'name', name: 'contacts.name'},
{ data: 'business_location', name: 'bl.name'},
{ data: 'action', name: 'action'}
]
});
}
});
function update_statistics(start, end) {
var location_id = '';
if ($('#dashboard_location').length > 0) {
location_id = $('#dashboard_location').val();
}
var data = { start: start, end: end, location_id: location_id };
//get purchase details
var loader = '<i class="fas fa-sync fa-spin fa-fw margin-bottom"></i>';
$('.total_purchase').html(loader);
$('.purchase_due').html(loader);
$('.total_sell').html(loader);
$('.invoice_due').html(loader);
$('.total_expense').html(loader);
$.ajax({
method: 'get',
url: '/home/get-totals',
dataType: 'json',
data: data,
success: function(data) {
//purchase details
$('.total_purchase').html(__currency_trans_from_en(data.total_purchase, true));
$('.purchase_due').html(__currency_trans_from_en(data.purchase_due, true));
//sell details
$('.total_sell').html(__currency_trans_from_en(data.total_sell, true));
$('.invoice_due').html(__currency_trans_from_en(data.invoice_due, true));
//expense details
$('.total_expense').html(__currency_trans_from_en(data.total_expense, true));
},
});
}