Subversion Repositories SmartDukaan

Rev

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

Rev 32376 Rev 32390
Line 149... Line 149...
149
 
149
 
150
        console.log()
150
        console.log()
151
 
151
 
152
        if (confirm("Are you sure you want to add new Invoice") == true) {
152
        if (confirm("Are you sure you want to add new Invoice") == true) {
153
 
153
 
154
            doPostAjaxRequestWithJsonHandler(context
154
            doPostAjaxRequestWithJsonHandler(`${context}/newReceiveInvoice`, JSON
155
                + "/newReceiveInvoice", JSON
-
 
156
                .stringify(newReceiveInvoice), function (response) {
155
                .stringify(newReceiveInvoice), function (response) {
157
                if (response == 'true') {
156
                if (response == 'true') {
158
                    alert("successfully added");
157
                    alert("successfully added");
159
                    localStorage.removeItem("invoiceDocument");
158
                    localStorage.removeItem("invoiceDocument");
160
                    loadNewReceiveInvoice("main-content");
159
                    loadNewReceiveInvoice("main-content");
Line 169... Line 168...
169
    var purchaseItemIds;
168
    var purchaseItemIds;
170
    $(document).on('click', ".purchaseorderitemview", function () {
169
    $(document).on('click', ".purchaseorderitemview", function () {
171
        purchaseItemIds = [];
170
        purchaseItemIds = [];
172
        var vendorId = $('#vendorId').val();
171
        var vendorId = $('#vendorId').val();
173
        var warehouseId = $('#warehouseMap').val();
172
        var warehouseId = $('#warehouseMap').val();
-
 
173
        var poDate = $('#poDate').val();
174
 
174
 
175
        console.log(warehouseId);
175
        console.log(warehouseId);
176
 
176
 
177
        if (warehouseId === null && vendorId === "") {
177
        if (warehouseId === null && vendorId === "") {
178
            alert("Field can't be empty");
178
            alert("Field can't be empty");
179
            return;
179
            return;
180
        }
180
        }
181
 
181
 
-
 
182
        if (poDate === '') {
-
 
183
            alert("PO Date is required");
-
 
184
            return;
-
 
185
        }
-
 
186
 
-
 
187
        if (warehouseId === null && vendorId === "") {
-
 
188
            alert("Field can't be empty");
-
 
189
            return;
-
 
190
        }
-
 
191
 
182
        if (warehouseId === null) {
192
        if (warehouseId === null) {
183
            alert("please select warehouse");
193
            alert("please select warehouse");
184
            return;
194
            return;
185
        }
195
        }
186
        if (vendorId === "") {
196
        if (vendorId === "") {
Line 261... Line 271...
261
        return true;
271
        return true;
262
    }
272
    }
263
 
273
 
264
    $(document).on('click', '.createSendPurchaseOrder', function () {
274
    $(document).on('click', '.createSendPurchaseOrder', function () {
265
 
275
 
266
        createPurchase(true);
276
        createPO(true);
267
 
277
 
268
    });
278
    });
269
 
279
 
270
 
280
 
271
    $(document).on('click', '.createPurchaseOrder', function () {
281
    $(document).on('click', '.createPurchaseOrder', function () {
272
 
282
 
273
 
283
 
274
        createPurchase(false);
284
        createPO(false);
275
    });
285
    });
276
 
286
 
277
 
287
 
278
    $(document).on('change', '.qty', function () {
288
    $(document).on('change', '.qty', function () {
279
 
289
 
Line 734... Line 744...
734
    doGetAjaxRequestHandler(context + "/getWarehouseInvoices", function (response) {
744
    doGetAjaxRequestHandler(context + "/getWarehouseInvoices", function (response) {
735
        $('#' + domId).html(response);
745
        $('#' + domId).html(response);
736
    });
746
    });
737
}
747
}
738
 
748
 
739
function createPurchase(sendPo) {
749
function createPO(sendPo) {
740
    var purchaseOrder = {};
750
    var purchaseOrder = {};
741
 
751
 
742
    var vendorId = $('#vendorId').val();
752
    var vendorId = $('#vendorId').val();
743
 
753
 
744
    var warehouseId = $('#warehouseMap').val();
754
    var warehouseId = $('#warehouseMap').val();
745
 
755
 
-
 
756
    var poDate = $('#poDate').val();
-
 
757
 
746
 
758
 
747
    var items = []
759
    var items = []
748
    $("table > tbody > tr").each(function () {
760
    $("table > tbody > tr").each(function () {
749
        var purchaseOrderJson = {};
761
        var purchaseOrderJson = {};
750
 
762
 
Line 804... Line 816...
804
    }
816
    }
805
 
817
 
806
    purchaseOrder['vendorId'] = vendorId;
818
    purchaseOrder['vendorId'] = vendorId;
807
    purchaseOrder['warehouseId'] = warehouseId
819
    purchaseOrder['warehouseId'] = warehouseId
808
    purchaseOrder['sendPo'] = sendPo
820
    purchaseOrder['sendPo'] = sendPo
809
 
-
 
-
 
821
    purchaseOrder['poDate'] = poDate;
810
    purchaseOrder['items'] = items
822
    purchaseOrder['items'] = items
811
 
823
 
812
    console.log(purchaseOrder)
824
    console.log(purchaseOrder)
813
 
825
 
814
 
826