Subversion Repositories SmartDukaan

Rev

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

Rev 32629 Rev 32638
Line 84... Line 84...
84
        var supplierId = $('#vendorId').val();
84
        var supplierId = $('#vendorId').val();
85
 
85
 
86
        var totalValue = $('#totalValue').val();
86
        var totalValue = $('#totalValue').val();
87
 
87
 
88
        var invoiceNumber = $('#invoiceNumber').val();
88
        var invoiceNumber = $('#invoiceNumber').val();
-
 
89
       var invoiceDoc=$('#invoiceDoc').val();
89
 
90
 
90
 
-
 
-
 
91
       //var invoice=$('#invoice').val();
91
        var invoiceDoc = localStorage
92
//        var invoiceDoc = localStorage
92
            .getItem("invoiceDocument");
93
//            .getItem("invoiceDocument");
93
 
-
 
94
 
-
 
95
        console.log(invoiceDoc)
94
       console.log(invoiceDoc)
96
 
-
 
97
 
95
 
98
        if (invoiceDate === "" && warehouseId === "" && numItems === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
96
        if (invoiceDate === "" && warehouseId === "" && numItems === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
99
            alert("Field can't be empty");
97
            alert("Field can't be empty");
100
            return false;
98
            return false;
101
        }
99
        }
102
 
100
 
103
 
-
 
104
        if (invoiceDate === "") {
101
        if (invoiceDate === "") {
105
            alert("please select date");
102
            alert("Please select date");
106
            return false;
-
 
107
        }
-
 
108
        if (warehouseId === "") {
-
 
109
            alert("please choose warehouse");
-
 
110
            return false;
103
            return false;
111
        }
104
        }
-
 
105
         if (supplierId === "") {
-
 
106
             alert("Please choose supplier/Vendor");
-
 
107
              return false;
-
 
108
                }
112
 
109
 
113
        if (numItems === "") {
110
        if (invoiceNumber === "") {
114
            alert("please fill number of items.");
111
            alert("Please fill Invoice Number.");
115
            return false;
112
            return false;
116
        }
113
        }
117
 
-
 
118
 
-
 
119
        if (supplierId === "") {
114
        if (warehouseId === "") {
120
            alert("please choose supplier");
115
            alert("Please choose warehouse");
121
            return false;
116
            return false;
122
        }
117
        }
123
 
118
 
124
 
-
 
125
        if (totalValue === "") {
119
        if (numItems === "") {
126
            alert("please fill Total Value.");
120
            alert("Please fill number of items.");
127
            return false;
121
            return false;
128
        }
122
        }
129
 
-
 
130
        if (invoiceNumber === "") {
123
        if (totalValue === "") {
131
            alert("please fill Invoice Number.");
124
            alert("Please fill Total Value.");
132
            return false;
125
            return false;
133
        }
126
        }
134
 
-
 
135
 
-
 
-
 
127
        console.log('invoice doc', invoiceDoc);
136
        if (invoiceDoc === "") {
128
         if (invoiceDoc == null) {
137
            alert("please upload invoice.");
129
            alert("Please upload invoice.");
138
            return false;
130
            return false;
139
        }
131
        }
140
        var newReceiveInvoice = {};
132
        var newReceiveInvoice = {};
141
 
133
 
142
        newReceiveInvoice['invoiceDate'] = invoiceDate;
134
        newReceiveInvoice['invoiceDate'] = invoiceDate;
Line 150... Line 142...
150
        if (confirm("Are you sure you want to add new Invoice")) {
142
        if (confirm("Are you sure you want to add new Invoice")) {
151
 
143
 
152
            doPostAjaxRequestWithJsonHandler(`${context}/newReceiveInvoice`, JSON
144
            doPostAjaxRequestWithJsonHandler(`${context}/newReceiveInvoice`, JSON
153
                .stringify(newReceiveInvoice), function (response) {
145
                .stringify(newReceiveInvoice), function (response) {
154
                if (response == 'true') {
146
                if (response == 'true') {
155
                    alert("successfully added");
147
                    alert("Successfully added");
156
                    localStorage.removeItem("invoiceDocument");
148
                    localStorage.removeItem("invoiceDocument");
157
                    loadNewReceiveInvoice("main-content");
149
                    loadNewReceiveInvoice("main-content");
158
                }
150
                }
159
            });
151
            });
160
        }
152
        }