Subversion Repositories SmartDukaan

Rev

Rev 33809 | Rev 35806 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33809 Rev 34047
Line 28... Line 28...
28
        var startDate = getDatesFromPicker('input[name="invoice-duration"]').startDate;
28
        var startDate = getDatesFromPicker('input[name="invoice-duration"]').startDate;
29
        var endDate = getDatesFromPicker('input[name="invoice-duration"]').endDate
29
        var endDate = getDatesFromPicker('input[name="invoice-duration"]').endDate
30
 
30
 
31
        var vendorId = $('#vendorId').val();
31
        var vendorId = $('#vendorId').val();
32
 
32
 
33
       // doGetAjaxRequestHandler(context + "/getWarehouseInvoicesByVendor?vendorId=" + vendorId + "&startDate=" + startDate + "&endDate=" + endDate, function (response) {
33
        // doGetAjaxRequestHandler(context + "/getWarehouseInvoicesByVendor?vendorId=" + vendorId + "&startDate=" + startDate + "&endDate=" + endDate, function (response) {
34
           // $('.invoicesviewcontainer').html(response);
34
        // $('.invoicesviewcontainer').html(response);
35
            doGetAjaxRequestHandler(context + "/getWarehouseInvoicesBydateWise?dateWiseInvoices="  + "&startDate=" + startDate + "&endDate=" + endDate, function (response) {
35
        doGetAjaxRequestHandler(context + "/getWarehouseInvoicesBydateWise?dateWiseInvoices=" + "&startDate=" + startDate + "&endDate=" + endDate, function (response) {
36
                        $('.invoicesviewcontainer').html(response);
36
            $('.invoicesviewcontainer').html(response);
37
            });
37
        });
38
 
38
 
39
    });
39
    });
40
 
40
 
41
    $(document).on('click', '.generateInvoicesExcel', function () {
41
    $(document).on('click', '.generateInvoicesExcel', function () {
42
 
42
 
Line 93... Line 93...
93
        var totalValue = $('#totalValue').val();
93
        var totalValue = $('#totalValue').val();
94
 
94
 
95
        var invoiceNumber = $('#invoiceNumber').val();
95
        var invoiceNumber = $('#invoiceNumber').val();
96
        //var invoiceDoc  =  $('#invoiceDoc').val();
96
        //var invoiceDoc  =  $('#invoiceDoc').val();
97
 
97
 
98
       var invoice=$('#invoice').val();
98
        var invoice = $('#invoice').val();
99
        var invoiceDoc = localStorage
99
        var invoiceDoc = localStorage
100
            .getItem("invoiceDocument");
100
            .getItem("invoiceDocument");
101
       console.log(invoiceDoc)
101
        console.log(invoiceDoc)
102
 
102
 
103
        if (invoiceDate === "" && warehouseId === "" && numItems === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
103
        if (invoiceDate === "" && warehouseId === "" && numItems === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
104
            alert("Field can't be empty");
104
            alert("Field can't be empty");
105
            return false;
105
            return false;
106
        }
106
        }
107
 
107
 
108
        if (invoiceDate === "") {
108
        if (invoiceDate === "") {
109
            alert("Please select date");
109
            alert("Please select date");
110
            return false;
110
            return false;
111
        }
111
        }
112
         if (supplierId === "") {
112
        if (supplierId === "") {
113
             alert("Please choose supplier/Vendor");
113
            alert("Please choose supplier/Vendor");
114
              return false;
114
            return false;
115
                }
115
        }
116
 
116
 
117
        if (invoiceNumber === "") {
117
        if (invoiceNumber === "") {
118
            alert("Please fill Invoice Number.");
118
            alert("Please fill Invoice Number.");
119
            return false;
119
            return false;
120
        }
120
        }
Line 130... Line 130...
130
        if (totalValue === "") {
130
        if (totalValue === "") {
131
            alert("Please fill Total Value.");
131
            alert("Please fill Total Value.");
132
            return false;
132
            return false;
133
        }
133
        }
134
        console.log('invoice doc', invoiceDoc);
134
        console.log('invoice doc', invoiceDoc);
135
         if (invoiceDoc === "" ) {
135
        if (invoiceDoc === "") {
136
            alert("Please upload invoice.");
136
            alert("Please upload invoice.");
137
            return false;
137
            return false;
138
        }
138
        }
139
        var newReceiveInvoice = {};
139
        var newReceiveInvoice = {};
140
 
140
 
Line 231... Line 231...
231
 
231
 
232
        $('tbody').append($html);
232
        $('tbody').append($html);
233
        getVendorItemAheadOptions($html.find('.typeaheaditem'), vendorId, function (selectedItem) {
233
        getVendorItemAheadOptions($html.find('.typeaheaditem'), vendorId, function (selectedItem) {
234
            let poDate = $('#poDate').val();
234
            let poDate = $('#poDate').val();
235
            var itemId = selectedItem.itemId;
235
            var itemId = selectedItem.itemId;
-
 
236
            var description = selectedItem.itemDescription;
236
            if (addItem($html, itemId)) {
237
            if (itemId) {
237
                doGetAjaxRequestHandler(`${context}/getPricing?vendorId=${vendorId}&itemId=${itemId}&onDate=${poDate}`, function (response) {
238
                doGetAjaxRequestHandler(`${context}/getPricing?vendorId=${vendorId}&itemId=${itemId}&onDate=${poDate}`, function (response) {
238
                    if (response !== "null") {
239
                    if (response !== "null") {
-
 
240
                        if (response !== 'false') {
239
                        var jsonObj = JSON.parse(response);
241
                            var jsonObj = JSON.parse(response);
240
                        $html.find('.transferPrice').val(jsonObj.transferPrice);
242
                            $html.find('.transferPrice').val(jsonObj.transferPrice);
241
                        $html.find('input.qty').focus();
243
                            $html.find('input.qty').focus();
242
 
244
 
243
                        // Update the total value for this row
245
                            // Update the total value for this row
244
                        let qty = $html.find('.qty').val();
246
                            let qty = $html.find('.qty').val();
245
                        let transferPrice = jsonObj.transferPrice;
247
                            let transferPrice = jsonObj.transferPrice;
246
                        if (qty && transferPrice) {
248
                            if (qty && transferPrice) {
247
                            let total = qty * transferPrice;
249
                                let total = qty * transferPrice;
248
                            $html.find('.totalValue').val(total);
250
                                $html.find('.totalValue').val(total);
249
                            updateTotalValue();
251
                                updateTotalValue();
-
 
252
                            }
-
 
253
                            addItem($html, itemId);
-
 
254
                        } else {
-
 
255
                            $html.find('.typeaheaditem').val('');
-
 
256
                            alert(`Category not Define(eg- HID, SLOW MOVING, FAST MOVING),First define the category of ${description} and Try again`);
250
                        }
257
                        }
-
 
258
 
251
                    } else {
259
                    } else {
252
                        $html.find('.typeaheaditem').val("");
260
                        $html.find('.typeaheaditem').val('');
253
                    }
261
                    }
254
                });
262
                });
255
            } else {
263
            } else {
256
                return false;
264
                return false;
257
            }
265
            }
Line 530... Line 538...
530
 
538
 
531
        var grnItemArray = [];
539
        var grnItemArray = [];
532
 
540
 
533
        var invoiceId = $(this).data("invoiceid");
541
        var invoiceId = $(this).data("invoiceid");
534
 
542
 
535
 
-
 
536
        $("#invoice-purchase-validate > tbody > tr").each(function () {
543
        $("#invoice-purchase-validate > tbody > tr").each(function () {
537
            var grnItemJson = {};
544
            var grnItemJson = {};
538
 
545
 
539
            var itemId = $(this).find(".itemId").text();
546
            var itemId = $(this).find(".itemId").text();
540
            var qty = $(this).find(".qty").text();
547
            var qty = $(this).find(".qty").text();
Line 1102... Line 1109...
1102
 
1109
 
1103
    });
1110
    });
1104
}
1111
}
1105
 
1112
 
1106
function removeInvoice(invoiceId) {
1113
function removeInvoice(invoiceId) {
1107
    if(confirm(`Are your sure want to delete invoiceId ${invoiceId}`)) {
1114
    if (confirm(`Are your sure want to delete invoiceId ${invoiceId}`)) {
1108
        doGetAjaxRequestHandler(`${context}/removeInvoice?invoiceId=${invoiceId}`, function (response) {
1115
        doGetAjaxRequestHandler(`${context}/removeInvoice?invoiceId=${invoiceId}`, function (response) {
1109
            $('#open-invoices').DataTable().row("#"+invoiceId).remove().draw();
1116
            $('#open-invoices').DataTable().row("#" + invoiceId).remove().draw();
1110
            alert("Invoice Removed");
1117
            alert("Invoice Removed");
1111
        });
1118
        });
1112
    }
1119
    }
1113
}
1120
}
1114
 
1121
 
1115
function removeGrnRequest(invoiceId) {
1122
function removeGrnRequest(invoiceId) {
1116
    if(confirm(`Are your sure want to remove grn request for invoiceId ${invoiceId}`)) {
1123
    if (confirm(`Are your sure want to remove grn request for invoiceId ${invoiceId}`)) {
1117
        doGetAjaxRequestHandler(`${context}/removeGrnRequest?invoiceId=${invoiceId}`, function (response) {
1124
        doGetAjaxRequestHandler(`${context}/removeGrnRequest?invoiceId=${invoiceId}`, function (response) {
1118
            $('#' + domId).html(response);
1125
            $('#' + domId).html(response);
1119
            alert("Grn Request Removed");
1126
            alert("Grn Request Removed");
1120
        });
1127
        });
1121
    }
1128
    }