Uang Masuk
@@ -118,7 +118,7 @@
file_jimp_worker: "{{ asset('assets/js/worker/jimp.js') }}",
storage_lara: "{{ asset('storage') }}/",
periodeStartDate: '', // unix timestamps
- periodeEndDate: '', // unix timestamps
+ periodeEndDate: '', // unix timestamps
stts_order: {
wait: "{{ App\Models\Orders::STTS_WAIT }}",
confirm: "{{ App\Models\Orders::STTS_CONFIRM }}",
@@ -176,59 +176,79 @@
};
const Filter = {
- activate: function() {
- const startDate = moment().startOf('month');
- const endDate = moment().endOf('month');
- $('#filter-startDate').val(startDate.format('YYYY-MM-DD')).trigger('change');
- $('#filter-endDate').val(endDate.format('YYYY-MM-DD')).trigger('change');
- State.periodeStartDate = startDate.unix();
- State.periodeEndDate = endDate.unix();
- Filter.evPeriodeDate();
- },
- evPeriodeDate: function() {
- $('#filter-startDate').on('change', function(e) {
- const { isValid, data } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
- if (!isValid) return false;
+ activate: function() {
+ const startDate = moment().startOf('month');
+ const endDate = moment().endOf('month');
+ $('#filter-startDate').val(startDate.format('YYYY-MM-DD')).trigger('change');
+ $('#filter-endDate').val(endDate.format('YYYY-MM-DD')).trigger('change');
+ State.periodeStartDate = startDate.unix();
+ State.periodeEndDate = endDate.unix();
+ Filter.evPeriodeDate();
+ },
+ evPeriodeDate: function() {
+ $('#filter-startDate').on('change', function(e) {
+ const {
+ isValid,
+ data
+ } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
+ if (!isValid) return false;
State.periodeStartDate = data.startDate.unix();
- State.periodeEndDate = data.endDate.unix();
- DTable.reload();
- });
- $('#filter-endDate').on('change', function(e) {
- const { isValid, data } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
- if (!isValid) return false;
+ State.periodeEndDate = data.endDate.unix();
+ DTable.reload();
+ });
+ $('#filter-endDate').on('change', function(e) {
+ const {
+ isValid,
+ data
+ } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
+ if (!isValid) return false;
State.periodeStartDate = data.startDate.unix();
- State.periodeEndDate = data.endDate.unix();
- DTable.reload();
- });
- },
- calcPeriodeDate: function(startDate, endDate) {
- if (startDate.format('YYYY-MM-DD') === 'Invalid date') {
- Helper.toast('Warning', 'just now', 'Tanggal mulai periode tidak valid');
- return { isValid: false };
- }
- if (endDate.format('YYYY-MM-DD') === 'Invalid date') {
- Helper.toast('Warning', 'just now', 'Tanggal akhir periode tidak valid');
- return { isValid: false };
- }
- const duration = moment.duration(endDate.diff(startDate));
- const diffDays = duration.days();
- if (diffDays > 30) {
- Helper.toast('Warning', 'just now', 'Maksimal periode 1 bulan');
- return { isValid: false };
- }
- if (diffDays < 0) {
- Helper.toast('Warning', 'just now', 'Rentang periode tidak valid');
- return { isValid: false };
- }
- return { isValid: true, data: { startDate, endDate } };
- },
- }
+ State.periodeEndDate = data.endDate.unix();
+ DTable.reload();
+ });
+ },
+ calcPeriodeDate: function(startDate, endDate) {
+ if (startDate.format('YYYY-MM-DD') === 'Invalid date') {
+ Helper.toast('Warning', 'just now', 'Tanggal mulai periode tidak valid');
+ return {
+ isValid: false
+ };
+ }
+ if (endDate.format('YYYY-MM-DD') === 'Invalid date') {
+ Helper.toast('Warning', 'just now', 'End date of the period is not valid');
+ return {
+ isValid: false
+ };
+ }
+ const duration = moment.duration(endDate.diff(startDate));
+ const diffDays = duration.days();
+ if (diffDays > 30) {
+ Helper.toast('Warning', 'just now', 'Maksimal periode 1 bulan');
+ return {
+ isValid: false
+ };
+ }
+ if (diffDays < 0) {
+ Helper.toast('Warning', 'just now', 'Rentang periode tidak valid');
+ return {
+ isValid: false
+ };
+ }
+ return {
+ isValid: true,
+ data: {
+ startDate,
+ endDate
+ }
+ };
+ },
+ }
const DTable = {
- table: null,
+ table: null,
activate: function() {
DTable.reload();
- DTable.eventChildRow();
+ DTable.eventChildRow();
},
reload: function() {
// $('#tLedgerBl').DataTable();
@@ -277,19 +297,19 @@
// searchable: true,
// render: function(data, type, row, meta) {
// let action = `
- //
- //
- //
- // `;
+ //
+ //
+ //
+ // `;
// return action;
// }
// },
- {
- "className": 'dt-control',
- "orderable": false,
- "data": null,
- "defaultContent": '',
- },
+ {
+ "className": 'dt-control',
+ "orderable": false,
+ "data": null,
+ "defaultContent": '',
+ },
{
data: 'ord_code',
className: 'text-start text-nowrap',
@@ -339,7 +359,7 @@
searchable: true,
render: function(data, type, row, meta) {
return (new Intl.NumberFormat('id-ID')).format(data);
- // return (new Intl.NumberFormat('id-ID')).format(row.total_in - row.total_out);
+ // return (new Intl.NumberFormat('id-ID')).format(row.total_in - row.total_out);
},
},
],
@@ -354,72 +374,74 @@
$('#totAllIn').text((new Intl.NumberFormat('id-ID')).format(total_in));
$('#totAllOut').text((new Intl.NumberFormat('id-ID')).format(total_out));
},
- eventChildRow: function() {
- $('#tLedgerBl tbody').on('click', 'td.dt-control', function () {
- var tr = $(this).closest('tr');
- var row = DTable.table.row( tr );
-
- if ( row.child.isShown() ) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- }
- else {
- // Open this row
- row.child( DTable.formatChildRow(row.data()) ).show();
- tr.addClass('shown');
- }
- } );
- },
- formatChildRow: function(d) {
- // `d` is the original data object for the row
- // let template = `
- let template = `
-
-
- | Item |
- Jumlah |
- Satuan |
- Invoice (Rp) |
- Pembayaran (Rp) |
- Masuk (Rp) |
- Keluar (Rp) |
- Balance (Rp) |
-
-
- `
- for (let item of d.a_items) {
- // perlu diperbaiki cara if di query, jika kalkulasi ke vendor maka is_aprv = , jika ke client is_bill_aprv = 1
- if (item.calc_to_vdr == State.calc_to_vdr.yes && item.is_aprv != State.is_aprv.yes) continue;
- if (item.invc_to_client == State.invc_to_client.yes && item.is_bill_aprv != State.is_aprv.yes) continue;
+ eventChildRow: function() {
+ $('#tLedgerBl tbody').on('click', 'td.dt-control', function() {
+ var tr = $(this).closest('tr');
+ var row = DTable.table.row(tr);
- let small_desc = '', amt_in = 0, amt_out = 0, amt_bl = 0;
- if (item.is_bill_paid == State.is_a_item_paid.paid) {
- amt_in = item.amt_in;
- small_desc += `
waktu dibayarkan ${moment.unix(item.paid_bill_at).format('DD MMM YYYY HH:mm:ss')}`;
+ if (row.child.isShown()) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ } else {
+ // Open this row
+ row.child(DTable.formatChildRow(row.data())).show();
+ tr.addClass('shown');
}
- if (item.is_paid == State.is_a_item_paid.paid) {
- amt_out = item.amt_out;
- small_desc += `
waktu keluar ${moment.unix(item.paid_at).format('DD MMM YYYY HH:mm:ss')}`;
- }
- if (amt_in != 0 || amt_out != 0) {
- amt_bl = item.amt_bl;
- }
- template += `
- | ${item.item_desc}${small_desc} |
- ${item.unit_qty} |
- ${item.unit_type_name} |
- ${(new Intl.NumberFormat('id-ID')).format(item.amt_in)} |
- ${(new Intl.NumberFormat('id-ID')).format(item.amt_out)} |
- ${(new Intl.NumberFormat('id-ID')).format(amt_in)} |
- ${(new Intl.NumberFormat('id-ID')).format(amt_out)} |
- ${(new Intl.NumberFormat('id-ID')).format(amt_bl)} |
-
`;
+ });
+ },
+ formatChildRow: function(d) {
+ // `d` is the original data object for the row
+ // let template = `
+ let template = `
+
+
+ | Item |
+ Jumlah |
+ Satuan |
+ Invoice (Rp) |
+ Pembayaran (Rp) |
+ Masuk (Rp) |
+ Keluar (Rp) |
+ Balance (Rp) |
+
+
+ `
+ for (let item of d.a_items) {
+ // perlu diperbaiki cara if di query, jika kalkulasi ke vendor maka is_aprv = , jika ke client is_bill_aprv = 1
+ if (item.calc_to_vdr == State.calc_to_vdr.yes && item.is_aprv != State.is_aprv.yes) continue;
+ if (item.invc_to_client == State.invc_to_client.yes && item.is_bill_aprv != State.is_aprv.yes) continue;
+
+ let small_desc = '',
+ amt_in = 0,
+ amt_out = 0,
+ amt_bl = 0;
+ if (item.is_bill_paid == State.is_a_item_paid.paid) {
+ amt_in = item.amt_in;
+ small_desc += `
waktu dibayarkan ${moment.unix(item.paid_bill_at).format('DD MMM YYYY HH:mm:ss')}`;
}
- template += `
-
`;
+ if (item.is_paid == State.is_a_item_paid.paid) {
+ amt_out = item.amt_out;
+ small_desc += `
waktu keluar ${moment.unix(item.paid_at).format('DD MMM YYYY HH:mm:ss')}`;
+ }
+ if (amt_in != 0 || amt_out != 0) {
+ amt_bl = item.amt_bl;
+ }
+ template += `
+ | ${item.item_desc}${small_desc} |
+ ${item.unit_qty} |
+ ${item.unit_type_name} |
+ ${(new Intl.NumberFormat('id-ID')).format(item.amt_in)} |
+ ${(new Intl.NumberFormat('id-ID')).format(item.amt_out)} |
+ ${(new Intl.NumberFormat('id-ID')).format(amt_in)} |
+ ${(new Intl.NumberFormat('id-ID')).format(amt_out)} |
+ ${(new Intl.NumberFormat('id-ID')).format(amt_bl)} |
+
`;
+ }
+ template += `
+
`;
return template
- },
+ },
};
Wrapper.activate();
diff --git a/resources/views/menu_v2/Finance/payment.blade.php b/resources/views/menu_v2/Finance/payment.blade.php
index b0eae41..9540e4b 100755
--- a/resources/views/menu_v2/Finance/payment.blade.php
+++ b/resources/views/menu_v2/Finance/payment.blade.php
@@ -122,8 +122,8 @@
const State = {
file_jimp_worker: "{{ asset('assets/js/worker/jimp.js') }}",
storage_lara: "{{ asset('storage') }}/",
- periodeStartDate: '', // unix timestamps
- periodeEndDate: '', // unix timestamps
+ periodeStartDate: '', // unix timestamps
+ periodeEndDate: '', // unix timestamps
stts_order: {
wait: "{{ App\Models\Orders::STTS_WAIT }}",
confirm: "{{ App\Models\Orders::STTS_CONFIRM }}",
@@ -147,7 +147,7 @@
const Wrapper = {
activate: function() {
- Filter.activate();
+ Filter.activate();
Wrapper.event();
DTable.activate();
},
@@ -157,7 +157,7 @@
return 'Lunas';
} else if (State.is_paid.yes == row.is_vdr_paid) {
if (row.total_payment !== row.total_payed) {
- return 'Belum lunas';
+ return 'Belum lunas';
}
return 'Lunas';
} else if (State.stts_order.drop == stts) {
@@ -180,54 +180,74 @@
},
};
- const Filter = {
- activate: function() {
- const startDate = moment().startOf('month');
- const endDate = moment().endOf('month');
- $('#filter-startDate').val(startDate.format('YYYY-MM-DD')).trigger('change');
- $('#filter-endDate').val(endDate.format('YYYY-MM-DD')).trigger('change');
- State.periodeStartDate = startDate.unix();
- State.periodeEndDate = endDate.unix();
- Filter.evPeriodeDate();
- },
- evPeriodeDate: function() {
- $('#filter-startDate').on('change', function(e) {
- const { isValid, data } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
- if (!isValid) return false;
+ const Filter = {
+ activate: function() {
+ const startDate = moment().startOf('month');
+ const endDate = moment().endOf('month');
+ $('#filter-startDate').val(startDate.format('YYYY-MM-DD')).trigger('change');
+ $('#filter-endDate').val(endDate.format('YYYY-MM-DD')).trigger('change');
+ State.periodeStartDate = startDate.unix();
+ State.periodeEndDate = endDate.unix();
+ Filter.evPeriodeDate();
+ },
+ evPeriodeDate: function() {
+ $('#filter-startDate').on('change', function(e) {
+ const {
+ isValid,
+ data
+ } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
+ if (!isValid) return false;
State.periodeStartDate = data.startDate.unix();
- State.periodeEndDate = data.endDate.unix();
- DTable.reload();
- });
- $('#filter-endDate').on('change', function(e) {
- const { isValid, data } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
- if (!isValid) return false;
+ State.periodeEndDate = data.endDate.unix();
+ DTable.reload();
+ });
+ $('#filter-endDate').on('change', function(e) {
+ const {
+ isValid,
+ data
+ } = Filter.calcPeriodeDate(moment($('#filter-startDate').val()), moment($('#filter-endDate').val()))
+ if (!isValid) return false;
State.periodeStartDate = data.startDate.unix();
- State.periodeEndDate = data.endDate.unix();
- DTable.reload();
- });
- },
- calcPeriodeDate: function(startDate, endDate) {
- if (startDate.format('YYYY-MM-DD') === 'Invalid date') {
- Helper.toast('Warning', 'just now', 'Tanggal mulai periode tidak valid');
- return { isValid: false };
- }
- if (endDate.format('YYYY-MM-DD') === 'Invalid date') {
- Helper.toast('Warning', 'just now', 'Tanggal akhir periode tidak valid');
- return { isValid: false };
- }
- const duration = moment.duration(endDate.diff(startDate));
- const diffDays = duration.days();
- if (diffDays > 30) {
- Helper.toast('Warning', 'just now', 'Maksimal periode 1 bulan');
- return { isValid: false };
- }
- if (diffDays < 0) {
- Helper.toast('Warning', 'just now', 'Rentang periode tidak valid');
- return { isValid: false };
- }
- return { isValid: true, data: { startDate, endDate } };
- },
- }
+ State.periodeEndDate = data.endDate.unix();
+ DTable.reload();
+ });
+ },
+ calcPeriodeDate: function(startDate, endDate) {
+ if (startDate.format('YYYY-MM-DD') === 'Invalid date') {
+ Helper.toast('Warning', 'just now', 'Tanggal mulai periode tidak valid');
+ return {
+ isValid: false
+ };
+ }
+ if (endDate.format('YYYY-MM-DD') === 'Invalid date') {
+ Helper.toast('Warning', 'just now', 'End date of the period is not valid');
+ return {
+ isValid: false
+ };
+ }
+ const duration = moment.duration(endDate.diff(startDate));
+ const diffDays = duration.days();
+ if (diffDays > 30) {
+ Helper.toast('Warning', 'just now', 'Maksimal periode 1 bulan');
+ return {
+ isValid: false
+ };
+ }
+ if (diffDays < 0) {
+ Helper.toast('Warning', 'just now', 'Rentang periode tidak valid');
+ return {
+ isValid: false
+ };
+ }
+ return {
+ isValid: true,
+ data: {
+ startDate,
+ endDate
+ }
+ };
+ },
+ }
const DTable = {
activate: function() {