Commit c765369af9d3fba09ecb5fd93969e107305a9b1d

Authored by Neeraj Sharma
1 parent a4fce59de4

solve bugs

src/pages/Account/editInvoice.vue
... ... @@ -35,7 +35,7 @@
35 35 v-model="editData.classId"
36 36 item-text="classNum"
37 37 item-value="_id"
38   - @change="getAllStudents()"
  38 + @change="getAllStudents(editData.classId)"
39 39 ></v-select>
40 40 </v-flex>
41 41 </v-layout>
... ... @@ -47,10 +47,11 @@
47 47 <v-flex xs6 class="ml-3">
48 48 <v-select
49 49 :items="studentList"
50   - label="Select Incharge"
51 50 v-model="editData.studentId"
  51 + :label="editData.studentId.name"
52 52 item-text="name"
53 53 item-value="_id"
  54 + @change="getStudentId(editData.studentId)"
54 55 ></v-select>
55 56 </v-flex>
56 57 </v-layout>
... ... @@ -317,7 +318,8 @@ export default {
317 318 name: "Fully Paid",
318 319 value: "FULLY_PAID"
319 320 }
320   - ]
  321 + ],
  322 + editDataObj: {}
321 323 }),
322 324 // watch: {
323 325 // menu1(val) {
... ... @@ -332,18 +334,23 @@ export default {
332 334 return moment(date).format("MMMM DD, YYYY");
333 335 },
334 336 update(editData) {
335   - // console.log("editData-----------", editData);
  337 + console.log("editData-----------", editData);
  338 + if (editData.classId._id) {
  339 + this.editDataObj.classNum = editData.classId._id;
  340 + }
  341 + if (editData.studentId._id) {
  342 + this.editDataObj.studentId = editData.studentId._id;
  343 + }
336 344 let feeTypeId = "";
337 345 for (let i = 0; i < this.feeTypes.length; i++) {
338 346 if (this.feeTypes[i].feeType === this.feeType.feeTypeName) {
339 347 feeTypeId = this.feeTypes[i]._id;
340 348 }
341 349 }
342   - // console.log(editData);
343 350 let editInvoiceData = {
344 351 invoiceId: editData._id,
345   - classId: editData.classNum,
346   - studentId: editData.sectionId,
  352 + classId: this.editDataObj.classNum,
  353 + studentId: this.editDataObj.studentId,
347 354 date: editData.date,
348 355 paymentStatus: editData.paymentStatus,
349 356 paymentMethod: editData.paymentMethod,
... ... @@ -353,39 +360,41 @@ export default {
353 360 totalSubTotal: this.feeType.subTotal,
354 361 totalPaidAmount: this.feeType.paidAmount
355 362 };
356   - if (editInvoiceData.paymentStatus == "NOT_PAID") {
357   - delete editInvoiceData.totalPaidAmount;
358   - }
  363 + // console.log(editInvoiceData, editInvoiceData);
359 364 if (feeTypeId == "") {
360 365 delete editInvoiceData.feeType[0].feeTypeId;
361 366 }
362   - if (editInvoiceData.paymentStatus == "NOT_PAID") {
363   - delete editInvoiceData.paymentMethod;
364   - }
365   - if (this.feeType.subTotal == this.feeType.paidAmount) {
366   - editInvoiceData.paymentStatus = "FULLY_PAID";
367   - // console.log("FULLY_PAID");
368   - }
369   - if (editInvoiceData.totalPaidAmount) {
370   - if (this.feeType.subTotal != this.feeType.paidAmount) {
371   - editInvoiceData.paymentStatus = "PARTIALLY_PAID";
372   - // console.log("PARTIALLY_PAID");
  367 + if (this.feeType.paidAmount != "0.00") {
  368 + if (this.feeType.subTotal == this.feeType.paidAmount) {
  369 + editInvoiceData.paymentStatus = "FULLY_PAID";
  370 + console.log("FULLY_PAID");
373 371 }
  372 + if (editInvoiceData.totalPaidAmount) {
  373 + if (this.feeType.subTotal != this.feeType.paidAmount) {
  374 + editInvoiceData.paymentStatus = "PARTIALLY_PAID";
  375 + console.log("PARTIALLY_PAID");
  376 + }
  377 + }
  378 + } else if (this.feeType.paidAmount === "0.00") {
  379 + editInvoiceData.paymentStatus = "NOT_PAID";
374 380 }
  381 + console.log("editInvoiceData", editInvoiceData);
  382 +
375 383 http()
376 384 .put("/updateInvoice", editInvoiceData)
377 385 .then(response => {
378 386 // this.getInvoiceList();
379 387 this.snackbar = true;
380   - this.text = "New Invoice added successfully";
  388 + this.text = "Edit Invoice successfully";
381 389 this.loading = false;
  390 + color: "red";
382 391 this.$emit("update-editInvoice");
383 392 })
384 393 .catch(error => {
385 394 console.log(error);
386   - if ((this.snackbar = true)) {
387   - this.text = error.response.data.message;
388   - }
  395 + this.snackbar = true;
  396 + this.text = error.response.data.message;
  397 + color: "red";
389 398 this.loading = false;
390 399 });
391 400 },
... ... @@ -393,7 +402,6 @@ export default {
393 402 this.$refs.form.reset();
394 403 },
395 404 selectFeeType() {
396   - // console.log("clckkkkkkkkkkkkkkkkkk", this.feeType.feeTypeName);
397 405 this.showFeeType = true;
398 406 this.editData.feeType.push({ feeTypeName: this.feeType.feeTypeName });
399 407 },
... ... @@ -417,7 +425,6 @@ export default {
417 425 })
418 426 .then(response => {
419 427 this.addclass = response.data.data;
420   - this.getAllStudents();
421 428 })
422 429 .catch(error => {
423 430 // console.log("err====>", err);
... ... @@ -430,19 +437,35 @@ export default {
430 437 }
431 438 });
432 439 },
433   - getAllStudents() {
  440 + getAllStudents(classId) {
  441 + // console.log("classId", classId);
  442 + this.editDataObj.classNum = classId;
  443 + this.editDataObj.studentId = "";
  444 + this.studentList = [];
  445 + this.showLoader = true;
434 446 http()
435 447 .get("/getStudentsList", {
436   - params: { classId: this.editData.classNum },
  448 + params: { classId: classId },
437 449 headers: { Authorization: "Bearer " + this.token }
438 450 })
439 451 .then(response => {
440   - this.studentList = response.data.data;
  452 + for (let i = 0; i < response.data.data.length; i++) {
  453 + this.studentList.push({
  454 + name: response.data.data[i].name,
  455 + _id: response.data.data[i]._id
  456 + });
  457 + }
  458 + this.showLoader = false;
441 459 })
442 460 .catch(err => {
443 461 // console.log("err====>", err);
  462 + this.showLoader = false;
444 463 });
445 464 },
  465 + getStudentId(studentId) {
  466 + // console.log("studentId", studentId);
  467 + this.editDataObj.studentId = studentId;
  468 + },
446 469 getfeeType() {
447 470 http()
448 471 .get("/getFeesList", {
... ... @@ -466,32 +489,58 @@ export default {
466 489 };
467 490 for (let i = 0; i < this.feeTypeData.length; i++) {
468 491 // *********** AMOUNT ***********
469   - feeType.amount =
470   - Number(feeType.amount) + Number(this.feeTypeData[i].amount);
471   - console.log("feeType.amount ", feeType.amount);
472   - this.feeType.amount = feeType.amount;
473   - this.feeType.subTotal = feeType.amount;
474   - this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
  492 + if (this.feeTypeData[i].amount) {
  493 + feeType.amount =
  494 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  495 + this.feeType.amount = feeType.amount;
  496 + this.feeType.subTotal = feeType.amount;
  497 + this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
  498 + } else if (this.feeTypeData[0].amount == "") {
  499 + this.feeType.amount = "0.00";
  500 + this.feeTypeData[i].subTotal = "0.00";
  501 + this.feeType.subTotal = "0.00";
  502 + } else if (this.feeTypeData[i].amount == "") {
  503 + this.feeType.amount =
  504 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  505 + this.feeTypeData[i].subTotal =
  506 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  507 + this.feeType.subTotal =
  508 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  509 + }
475 510 // *********** DISCOUNT ***********
476 511 if (this.feeTypeData[i].discount) {
477 512 feeType.discount =
478 513 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
479   - console.log("feeType.discount", feeType.discount);
480 514 this.feeType.discount = feeType.discount;
481 515 feeType.subParticularTotal =
482 516 this.feeTypeData[i].amount -
483 517 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
484   - console.log("feeType.subTotal", feeType.subTotal);
485 518 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2);
  519 + } else if (this.feeTypeData[0].discount == "") {
  520 + this.feeType.discount = "0.00";
  521 + } else if (this.feeTypeData[i].discount == "") {
  522 + this.feeType.discount =
  523 + Number(feeType.discount) + Number(this.feeTypeData[i].discount);
486 524 }
  525 +
487 526 // *********** SUBTOTAL ***********
488   - feeType.subTotal =
489   - Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
490   - this.feeType.subTotal = feeType.subTotal.toFixed(2);
  527 + if (this.feeTypeData[i].subTotal) {
  528 + feeType.subTotal =
  529 + Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
  530 + this.feeType.subTotal = feeType.subTotal.toFixed(2);
  531 + }
  532 +
491 533 // *********** PAID-AMOUNT ***********
492   - feeType.paidAmount =
493   - Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
494   - this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
  534 + if (this.feeTypeData[i].paidAmount) {
  535 + feeType.paidAmount =
  536 + Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
  537 + this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
  538 + } else if (this.feeTypeData[0].paidAmount == "") {
  539 + this.feeType.paidAmount = "0.00";
  540 + } else if (this.feeTypeData[i].paidAmount == "") {
  541 + this.feeType.paidAmount = feeType.paidAmount =
  542 + Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
  543 + }
495 544  
496 545 // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value.
497 546 if (feeType.paidAmount > feeType.subTotal) {
... ... @@ -505,6 +554,11 @@ export default {
505 554 this.showPayMethods = true;
506 555 } else if (this.editData.paymentStatus == "FULLY_PAID") {
507 556 this.showPayMethods = true;
  557 + } else if (this.editData.paymentStatus == "NOT_PAID") {
  558 + for (let i = 0; i < this.feeTypeData.length; i++) {
  559 + this.feeTypeData[i].paidAmount = "0.00";
  560 + this.feeType.paidAmount = "0.00";
  561 + }
508 562 } else {
509 563 this.showPayMethods = false;
510 564 }
... ...
src/pages/Account/invoice.vue
... ... @@ -22,191 +22,12 @@
22 22 <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon>
23 23 </v-flex>
24 24 </v-layout>
25   - <!-- <v-flex xs12 sm12>
26   - <v-container fluid grid-list-md>
27   - <v-layout wrap>
28   - <v-flex xs12 sm12 md4>
29   - <v-card flat>
30   - <v-toolbar dark class="card-styles" flat>
31   - <v-spacer></v-spacer>
32   - <h3>Profile</h3>
33   - <v-spacer></v-spacer>
34   - </v-toolbar>
35   - <v-card-text>
36   - <v-container>
37   - <v-layout wrap>
38   - <v-flex xs12>
39   - <v-layout>
40   - <v-flex
41   - xs12
42   - class="text-xs-center text-sm-center text-md-center text-lg-center"
43   - >
44   - <v-avatar size="80px">
45   - <img src="/static/icon/user.png" v-if="!editPayment.profilePicUrl" />
46   - <img
47   - :src="editPayment.profilePicUrl"
48   - v-else-if="editPayment.profilePicUrl"
49   - />
50   - </v-avatar>
51   - </v-flex>
52   - </v-layout>
53   - <v-layout>
54   - <v-flex xs12 sm12>
55   - <h3 class="text-xs-center">
56   - <b>{{ editPayment.studentId.name }}</b>
57   - </h3>
58   - <p class="text-xs-center grey--text">Student</p>
59   - </v-flex>
60   - </v-layout>
61   - <v-layout style="border: 1px solid lightgrey;">
62   - <v-flex xs6 sm6 class="pa-0">
63   - <h4 class="right">
64   - <b>Roll No :</b>
65   - </h4>
66   - </v-flex>
67   - <v-flex sm6 xs6 class="pa-0">
68   - <h4>{{ editPayment.studentId.rollNo }}</h4>
69   - </v-flex>
70   - </v-layout>
71   - <v-layout style="border: 1px solid lightgrey;">
72   - <v-flex xs6 sm6 class="pa-0">
73   - <h4 class="right">
74   - <b>Class :</b>
75   - </h4>
76   - </v-flex>
77   - <v-flex sm6 xs6 class="pa-0">
78   - <h4>{{ editPayment.classId.classNum }}</h4>
79   - </v-flex>
80   - </v-layout>
81   - </v-flex>
82   - </v-layout>
83   - </v-container>
84   - </v-card-text>
85   - </v-card>
86   - <v-flex>
87   - <v-card>
88   - <v-flex xs12 sm12 md12 style="padding-top: 1%;">
89   - <v-card flat>
90   - <v-toolbar dark class="card-styles" flat>
91   - <v-spacer></v-spacer>
92   - <h3>Invoice</h3>
93   - <v-spacer></v-spacer>
94   - </v-toolbar>
95   - </v-card>
96   - <v-layout>
97   - <v-flex xs12>
98   - <v-layout>
99   - <v-flex xs4 class="pt-4 subheading">
100   - <label class="right">Payment Method:</label>
101   - </v-flex>
102   - <v-flex xs6 class="ml-3">
103   - <v-select
104   - :items="paymentMethods"
105   - v-model="editPayment.paymentMethod"
106   - label="Select Payment Method"
107   - required
108   - ></v-select>
109   - </v-flex>
110   - </v-layout>
111   - <v-card-actions>
112   - <v-spacer class="hidden-xs-only"></v-spacer>
113   - <v-btn
114   - color="open-dialog-button"
115   - dark
116   - class="right mt-3"
117   - @click="add"
118   - >Add Payment</v-btn>
119   - </v-card-actions>
120   - </v-flex>
121   - </v-layout>
122   - </v-flex>
123   - </v-card>
124   - </v-flex>
125   - </v-flex>
126   - <v-flex xs12 sm12 md8>
127   - <v-card>
128   - <v-toolbar dark class="card-styles" flat>
129   - <v-spacer></v-spacer>
130   - <h3>Fee Type List</h3>
131   - <v-spacer></v-spacer>
132   - </v-toolbar>
133   - <table class="feeTypeTable tableRsponsive">
134   - <tr class="info white--text">
135   - <th>#</th>
136   - <th>Fee Type</th>
137   - <th>Amount</th>
138   - <th>Discount(%)</th>
139   - <th>Subtotal</th>
140   - <th>Paid Amount</th>
141   - <th>Action</th>
142   - </tr>
143   - <tr
144   - v-for="(feeType,index) in paymentFeeTypeData"
145   - :key="index"
146   - v-on:keyup="getAmmountDetails(feeType)"
147   - >
148   - <td style="width:40px" class="tdFeeType">{{index + 1}}</td>
149   - <td style="width:120px" class="tdFeeType" disabled>{{ feeType.feeTypeName }}</td>
150   - <td class="tdFeeType" style="width:120px" disabled>{{feeType.amount}}</td>
151   - <td class="tdFeeType">
152   - <v-text-field
153   - placeholder="fill your Discount"
154   - v-model="feeType.discount"
155   - type="number"
156   - ></v-text-field>
157   - </td>
158   - <td class="tdFeeType" disabled>{{ feeType.subTotal }}</td>
159   - <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'">
160   - <v-text-field
161   - placeholder="fill your Paid Amount"
162   - v-model="feeType.paidAmount"
163   - type="number"
164   - ></v-text-field>
165   - </td>
166   - <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''">
167   - <v-text-field
168   - placeholder="fill your Paid Amount"
169   - v-model="feeType.paidAmount"
170   - type="number"
171   - ></v-text-field>
172   - </td>
173   - <td
174   - class="tdFeeType"
175   - v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''"
176   - >
177   - <v-text-field
178   - placeholder="fill your Paid Amount"
179   - v-model="feeType.paidAmount"
180   - type="number"
181   - ></v-text-field>
182   - </td>
183   - <td class="tdFeeType">
184   - <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon>
185   - </td>
186   - </tr>
187   - <tfoot>
188   - <tr>
189   - <td colspan="2" class="tdFeeType">Total:</td>
190   - <td class="tdFeeType">{{ feeType.amount }}</td>
191   - <td class="tdFeeType">{{ feeType.discount }}</td>
192   - <td class="tdFeeType">{{ feeType.subTotal }}</td>
193   - <td class="tdFeeType">{{ feeType.paidAmount }}</td>
194   - <td class="tdFeeType">
195   - <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon>
196   - </td>
197   - </tr>
198   - </tfoot>
199   - </table>
200   - </v-card>
201   - </v-flex>
202   - </v-layout>
203   - </v-container>
204   - </v-flex>-->
205 25 <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" />
206 26 </v-card>
207 27 </v-dialog>
208 28  
209 29 <!-- ****** PROFILE VIEW SECTION DATA ****** -->
  30 +
210 31 <v-dialog v-model="dialog1" max-width="800px">
211 32 <v-card flat class="text-xs-center white--text">
212 33 <v-layout>
... ... @@ -215,7 +36,6 @@
215 36 <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon>
216 37 </v-flex>
217 38 </v-layout>
218   - <!-- <p>{{editedItem}}</p> -->
219 39 <table class="feeTypeTable tableRsponsive">
220 40 <tr style="color: black">
221 41 <th>#</th>
... ... @@ -870,6 +690,12 @@ export default {
870 690 this.editedIndex = this.invoiceList.indexOf(item);
871 691 this.editPayment = Object.assign({}, item);
872 692 this.editPayment.date = this.editPayment.date.slice(0, 10);
  693 + if (this.editPayment.paymentStatus == "NOT_PAID") {
  694 + for (let i = 0; i < this.editPayment.feeType.length; i++) {
  695 + this.editPayment.feeType[i].paidAmount = "0.00";
  696 + }
  697 + }
  698 + // console.log("this.editPayment", this.editPayment);
873 699 this.paymentFeeTypeData = this.editPayment.feeType;
874 700 this.paymentInvoiceDialog = true;
875 701 },
... ... @@ -955,24 +781,25 @@ export default {
955 781 paymentStatus: this.invoiceData.paymentStatus,
956 782 paymentMethod: this.invoiceData.paymentMethod,
957 783 feeType: this.feeTypeData,
958   - totalAmount: this.feeType.amount,
959   - totalDiscount: this.feeType.discount,
  784 + totalAmount: this.feeType.amount.toString(),
  785 + totalDiscount: this.feeType.discount.toString(),
960 786 totalSubTotal: this.feeType.subTotal,
961 787 totalPaidAmount: this.feeType.paidAmount
962 788 };
963   - console.log("invoiceData", invoiceData);
964   - if (invoiceData.paymentStatus == "NOT_PAID") {
965   - delete invoiceData.totalPaidAmount;
966   - }
967   - if (this.feeType.subTotal == this.feeType.paidAmount) {
968   - invoiceData.paymentStatus = "FULLY_PAID";
969   - // console.log("FULLY_PAID");
970   - }
971   - if (invoiceData.totalPaidAmount) {
972   - if (this.feeType.subTotal != this.feeType.paidAmount) {
973   - invoiceData.paymentStatus = "PARTIALLY_PAID";
974   - // console.log("PARTIALLY_PAID");
  789 + // console.log("invoiceData", invoiceData);
  790 + if (this.feeType.paidAmount != "0.00") {
  791 + if (this.feeType.subTotal == this.feeType.paidAmount) {
  792 + invoiceData.paymentStatus = "FULLY_PAID";
  793 + console.log("FULLY_PAID");
  794 + }
  795 + if (invoiceData.totalPaidAmount) {
  796 + if (this.feeType.subTotal != this.feeType.paidAmount) {
  797 + invoiceData.paymentStatus = "PARTIALLY_PAID";
  798 + console.log("PARTIALLY_PAID");
  799 + }
975 800 }
  801 + } else if (this.feeType.paidAmount === "0.00") {
  802 + invoiceData.paymentStatus = "NOT_PAID";
976 803 }
977 804 http()
978 805 .post("/createInvoice", invoiceData)
... ... @@ -1003,40 +830,6 @@ export default {
1003 830 });
1004 831 }
1005 832 },
1006   - // add() {
1007   - // var updatePayment = {
1008   - // invoiceId: this.editPayment._id,
1009   - // // totalPaidAmount: this.editPayment.paidAmount
1010   - // classId: this.editPayment.classNum,
1011   - // students: this.editPayment.students,
1012   - // date: this.editPayment.date,
1013   - // paymentStatus: this.editPayment.paymentStatus,
1014   - // paymentMethod: this.editPayment.paymentMethod,
1015   - // feeType: this.feeTypeData,
1016   - // totalAmount: this.feeType.amount,
1017   - // totalDiscount: this.feeType.discount,
1018   - // totalSubTotal: this.feeType.subTotal,
1019   - // totalPaidAmount: this.feeType.paidAmount
1020   - // };
1021   - // http()
1022   - // .put("/updateInvoice", updatePayment, {
1023   - // headers: {
1024   - // Authorization: "Bearer " + this.token
1025   - // }
1026   - // })
1027   - // .then(response => {
1028   - // this.getInvoiceList();
1029   - // this.snackbar = true;
1030   - // this.text = response.data.message;
1031   - // this.color = "green";
1032   - // this.paymentInvoiceDialog = false;
1033   - // })
1034   - // .catch(error => {
1035   - // console.log("error", error);
1036   - // this.snackbar = true;
1037   - // this.color = "red";
1038   - // });
1039   - // },
1040 833 clear() {
1041 834 this.$refs.form.reset();
1042 835 },
... ... @@ -1066,9 +859,25 @@ export default {
1066 859 this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName });
1067 860 },
1068 861 deleteSelectFee: function(index) {
  862 + console.log("---index----", index);
1069 863 this.feeTypeData.splice(index, 1);
1070 864 for (let i = 0; i < this.feeTypeData.length; i++) {
1071   - this.feeType = this.feeTypeData[i];
  865 + console.log("this.feeTypeData[i]", this.feeTypeData[i]);
  866 + if (this.feeTypeData[i].paidAmount) {
  867 + this.feeType = {
  868 + amount: this.feeTypeData[i].amount,
  869 + discount: this.feeTypeData[i].discount,
  870 + subTotal: this.feeTypeData[i].subTotal,
  871 + paidAmount: this.feeTypeData[i].paidAmount
  872 + };
  873 + } else {
  874 + this.feeType = {
  875 + amount: this.feeTypeData[i].amount,
  876 + discount: this.feeTypeData[i].discount,
  877 + subTotal: this.feeTypeData[i].subTotal,
  878 + paidAmount: "0.00"
  879 + };
  880 + }
1072 881 }
1073 882 if (this.feeTypeData.length == 0) {
1074 883 this.feeType = {
... ... @@ -1145,16 +954,25 @@ export default {
1145 954 };
1146 955 for (let i = 0; i < this.feeTypeData.length; i++) {
1147 956 // *********** AMOUNT ***********
1148   -
1149   - feeType.amount =
1150   - Number(feeType.amount) + Number(this.feeTypeData[i].amount);
1151   - // console.log("feeType.amount ", feeType.amount);
1152   - this.feeType.amount = feeType.amount;
1153   - this.feeType.subTotal = feeType.amount;
1154   - this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
1155   -
  957 + if (this.feeTypeData[i].amount) {
  958 + feeType.amount =
  959 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  960 + this.feeType.amount = feeType.amount;
  961 + this.feeType.subTotal = feeType.amount;
  962 + this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
  963 + } else if (this.feeTypeData[0].amount == "") {
  964 + this.feeType.amount = "0.00";
  965 + this.feeTypeData[i].subTotal = "0.00";
  966 + this.feeType.subTotal = "0.00";
  967 + } else if (this.feeTypeData[i].amount == "") {
  968 + this.feeType.amount =
  969 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  970 + this.feeTypeData[i].subTotal =
  971 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  972 + this.feeType.subTotal =
  973 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  974 + }
1156 975 // *********** DISCOUNT ***********
1157   -
1158 976 if (this.feeTypeData[i].discount) {
1159 977 feeType.discount =
1160 978 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
... ... @@ -1163,20 +981,32 @@ export default {
1163 981 this.feeTypeData[i].amount -
1164 982 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
1165 983 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2);
  984 + } else if (this.feeTypeData[0].discount == "") {
  985 + this.feeType.discount = "0.00";
  986 + } else if (this.feeTypeData[i].discount == "") {
  987 + this.feeType.discount =
  988 + Number(feeType.discount) + Number(this.feeTypeData[i].discount);
1166 989 }
1167 990  
1168 991 // *********** SUBTOTAL ***********
1169   -
1170   - feeType.subTotal =
1171   - Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
1172   - this.feeType.subTotal = feeType.subTotal.toFixed(2);
  992 + if (this.feeTypeData[i].subTotal) {
  993 + feeType.subTotal =
  994 + Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
  995 + this.feeType.subTotal = feeType.subTotal.toFixed(2);
  996 + }
1173 997  
1174 998 // *********** PAID-AMOUNT ***********
1175 999 if (this.feeTypeData[i].paidAmount) {
1176 1000 feeType.paidAmount =
1177 1001 Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
1178 1002 this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
  1003 + } else if (this.feeTypeData[0].paidAmount == "") {
  1004 + this.feeType.paidAmount = "0.00";
  1005 + } else if (this.feeTypeData[i].paidAmount == "") {
  1006 + this.feeType.paidAmount = feeType.paidAmount =
  1007 + Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
1179 1008 }
  1009 +
1180 1010 // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value.
1181 1011 if (feeType.paidAmount > feeType.subTotal) {
1182 1012 this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal;
... ... @@ -1189,21 +1019,16 @@ export default {
1189 1019 this.showPayMethods = true;
1190 1020 } else if (this.invoiceData.paymentStatus == "FULLY_PAID") {
1191 1021 this.showPayMethods = true;
1192   - } else {
1193   - this.showPayMethods = false;
1194   - }
1195   - },
1196   - getPaymentMethod() {
1197   - if (this.editData.paymentStatus == "PARTIALLY_PAID") {
1198   - this.showPayMethods = true;
1199   - } else if (this.editData.paymentStatus == "FULLY_PAID") {
1200   - this.showPayMethods = true;
  1022 + } else if (this.invoiceData.paymentStatus == "NOT_PAID") {
  1023 + for (let i = 0; i < this.feeTypeData.length; i++) {
  1024 + this.feeTypeData[i].paidAmount = "0.00";
  1025 + this.feeType.paidAmount = "0.00";
  1026 + }
1201 1027 } else {
1202 1028 this.showPayMethods = false;
1203 1029 }
1204 1030 },
1205 1031 selectAllStudent() {
1206   - // console.log("this.studentId", this.invoiceData.studentId);
1207 1032 this.invoiceData.students = [];
1208 1033 if (this.invoiceData.studentId === "Select All") {
1209 1034 for (let i = 1; i < this.studentList.length; i++) {
... ... @@ -1217,7 +1042,8 @@ export default {
1217 1042 }
1218 1043 },
1219 1044 displaySearch() {
1220   - (this.show = false), (this.showSearch = true);
  1045 + this.show = false;
  1046 + this.showSearch = true;
1221 1047 },
1222 1048 closeSearch() {
1223 1049 this.showSearch = false;
... ...
src/pages/Account/paymentTemplate.vue
... ... @@ -154,7 +154,7 @@
154 154 type="number"
155 155 ></v-text-field>
156 156 </td>
157   - <td>
  157 + <td v-if="!editPayment.feeType">
158 158 <v-icon
159 159 color="error"
160 160 @click="deleteSelectFee(feeType,editPayment.feeType,index)"
... ... @@ -287,23 +287,27 @@ export default {
287 287 totalSubTotal: this.feeType.subTotal,
288 288 totalPaidAmount: this.feeType.paidAmount
289 289 };
290   - if (editInvoiceData.paymentStatus == "NOT_PAID") {
291   - delete editInvoiceData.totalPaidAmount;
292   - }
293 290 if (feeTypeId == "") {
294 291 delete editInvoiceData.feeType[0].feeTypeId;
295 292 }
296 293 if (editInvoiceData.paymentStatus == "NOT_PAID") {
297 294 delete editInvoiceData.paymentMethod;
298 295 }
299   - if (editInvoiceData.paymentStatus == "NOT_PAID") {
300   - delete invoiceData.totalPaidAmount;
301   - }
302   - if (this.feeType.subTotal == this.feeType.paidAmount) {
303   - editInvoiceData.paymentStatus = "FULLY_PAID";
304   - // console.log("FULLY_PAID");
  296 + if (editInvoiceData.totalPaidAmount == "0") {
  297 + if (editInvoiceData.paymentStatus == "NOT_PAID") {
  298 + delete editInvoiceData.totalPaidAmount;
  299 + }
305 300 }
306   - if (editInvoiceData.totalPaidAmount) {
  301 + console.log("editInvoiceData", editInvoiceData);
  302 + console.log(
  303 + "editInvoiceData.totalPaidAmount",
  304 + editInvoiceData.totalPaidAmount
  305 + );
  306 + if (editInvoiceData.totalPaidAmount != "0.00") {
  307 + if (this.feeType.subTotal == this.feeType.paidAmount) {
  308 + editInvoiceData.paymentStatus = "FULLY_PAID";
  309 + }
  310 +
307 311 if (this.feeType.subTotal != this.feeType.paidAmount) {
308 312 editInvoiceData.paymentStatus = "PARTIALLY_PAID";
309 313 // console.log("PARTIALLY_PAID");
... ... @@ -402,32 +406,58 @@ export default {
402 406 };
403 407 for (let i = 0; i < this.feeTypeData.length; i++) {
404 408 // *********** AMOUNT ***********
405   - feeType.amount =
406   - Number(feeType.amount) + Number(this.feeTypeData[i].amount);
407   - console.log("feeType.amount ", feeType.amount);
408   - this.feeType.amount = feeType.amount;
409   - this.feeType.subTotal = feeType.amount;
410   - this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
  409 + if (this.feeTypeData[i].amount) {
  410 + feeType.amount =
  411 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  412 + this.feeType.amount = feeType.amount;
  413 + this.feeType.subTotal = feeType.amount;
  414 + this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
  415 + } else if (this.feeTypeData[0].amount == "") {
  416 + this.feeType.amount = "0.00";
  417 + this.feeTypeData[i].subTotal = "0.00";
  418 + this.feeType.subTotal = "0.00";
  419 + } else if (this.feeTypeData[i].amount == "") {
  420 + this.feeType.amount =
  421 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  422 + this.feeTypeData[i].subTotal =
  423 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  424 + this.feeType.subTotal =
  425 + Number(feeType.amount) + Number(this.feeTypeData[i].amount);
  426 + }
411 427 // *********** DISCOUNT ***********
412 428 if (this.feeTypeData[i].discount) {
413 429 feeType.discount =
414 430 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
415   - console.log("feeType.discount", feeType.discount);
416 431 this.feeType.discount = feeType.discount;
417 432 feeType.subParticularTotal =
418 433 this.feeTypeData[i].amount -
419 434 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
420   - console.log("feeType.subTotal", feeType.subTotal);
421 435 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2);
  436 + } else if (this.feeTypeData[0].discount == "") {
  437 + this.feeType.discount = "0.00";
  438 + } else if (this.feeTypeData[i].discount == "") {
  439 + this.feeType.discount =
  440 + Number(feeType.discount) + Number(this.feeTypeData[i].discount);
422 441 }
  442 +
423 443 // *********** SUBTOTAL ***********
424   - feeType.subTotal =
425   - Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
426   - this.feeType.subTotal = feeType.subTotal.toFixed(2);
  444 + if (this.feeTypeData[i].subTotal) {
  445 + feeType.subTotal =
  446 + Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
  447 + this.feeType.subTotal = feeType.subTotal.toFixed(2);
  448 + }
  449 +
427 450 // *********** PAID-AMOUNT ***********
428   - feeType.paidAmount =
429   - Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
430   - this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
  451 + if (this.feeTypeData[i].paidAmount) {
  452 + feeType.paidAmount =
  453 + Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
  454 + this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
  455 + } else if (this.feeTypeData[0].paidAmount == "") {
  456 + this.feeType.paidAmount = "0.00";
  457 + } else if (this.feeTypeData[i].paidAmount == "") {
  458 + this.feeType.paidAmount = feeType.paidAmount =
  459 + Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
  460 + }
431 461  
432 462 // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value.
433 463 if (feeType.paidAmount > feeType.subTotal) {
... ...
src/pages/Report/progressCardReport.vue
... ... @@ -58,7 +58,6 @@
58 58 item-text="name"
59 59 item-value="_id"
60 60 :rules="studentRules"
61   - @change="selectAllStudent()"
62 61 required
63 62 ></v-select>
64 63 </v-flex>
... ... @@ -90,6 +89,7 @@
90 89 </v-layout>-->
91 90 <v-container grid-list-md v-show="showReport" class="report">
92 91 <v-flex xs12 sm12 id="printMe">
  92 + <!-- {{filterData}} -->
93 93 <v-layout wrap>
94 94 <!-- ****** TABLE DATA MARK ****** -->
95 95 <v-flex xs12 sm12 md12>
... ... @@ -344,7 +344,7 @@
344 344 </tr>
345 345 <tr>
346 346 <td colspan="5">
347   - <span class="right subheding">Average Mark</span>
  347 + <span class="subheding">Average Mark</span>
348 348 </td>
349 349 <td
350 350 colspan="7"
... ... @@ -353,7 +353,7 @@
353 353 </tr>
354 354 <tr>
355 355 <td colspan="5">
356   - <span class="right subheding">GPA</span>
  356 + <span class="subheding">GPA</span>
357 357 </td>
358 358 <td
359 359 colspan="7"
... ... @@ -500,20 +500,6 @@ export default {
500 500 this.showLoader = false;
501 501 });
502 502 },
503   - selectAllStudent() {
504   - // console.log("this.studentId", this.getReport.studentId);
505   - // this.invoiceData.students = [];
506   - if (this.getReport.studentId === "Select All") {
507   - for (let i = 1; i < this.getStudentsList.length; i++) {
508   - // this.invoiceData.students.push(this.getStudentsList[i]._id);
509   - console.log("data", this.getStudentsList[i]._id);
510   - // data.push(this.studentList[i]._id);
511   - // console.log("data", data);
512   - }
513   - } else {
514   - this.invoiceData.students.push(this.invoiceData.studentId);
515   - }
516   - },
517 503 getMarkReportList() {
518 504 // this.showLoader = true;
519 505 this.showReport = true;
... ... @@ -549,9 +535,31 @@ export default {
549 535 // }
550 536 // }
551 537 // })
  538 + // console.log(
  539 + // "getReport.classId",
  540 + // this.getReport.classId,
  541 + // "getReport.sectionId",
  542 + // this.getReport.sectionId,
  543 + // "getReport.studentId",
  544 + // this.getReport.studentId
  545 + // );
  546 +
  547 + var getSelectMarks = {};
  548 + if (this.getReport.studentId == "Select All") {
  549 + getSelectMarks = {
  550 + classId: this.getReport.classId,
  551 + sectionId: this.getReport.sectionId
  552 + };
  553 + } else if(this.getReport.studentId != "Select All") {
  554 + getSelectMarks = {
  555 + classId: this.getReport.classId,
  556 + sectionId: this.getReport.sectionId,
  557 + studentId: this.getReport.studentId
  558 + };
  559 + }
552 560 http()
553 561 .get("/getParticularMark", {
554   - params: { studentId: this.getReport.studentId },
  562 + params: getSelectMarks,
555 563 headers: { Authorization: "Bearer " + this.token }
556 564 })
557 565 .then(response => {
... ... @@ -571,15 +579,12 @@ export default {
571 579 i < this.filterData[data][item].studentsMarks.length;
572 580 i++
573 581 ) {
574   - // console.log("this.filterData[data][item].studentsMarks[i]",this.filterData[data][item].studentsMarks[i]
575   - // .marksScored)
576 582 totalMarks += this.filterData[data][item].studentsMarks[i]
577 583 .marksScored;
578 584 }
579 585 this.filterData[data][item].totalMarks = totalMarks;
580 586 console.log("totalMarks", totalMarks);
581 587 this.totalMarks = totalMarks;
582   - // console.log("this.filterData[data][item].grade", this.filterData[data][item].grade);
583 588 if (totalMarks > 90) {
584 589 this.filterData[data][item].grade = this.gradeAPlus;
585 590 } else if (totalMarks > 80 && totalMarks < 90) {
... ...