Blame view

src/pages/Account/invoice.vue 38.9 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
  <template>
68d742034   Neeraj Sharma   implement new des...
2
    <v-container fluid class="body-color">
81d876b5d   Shikha Mishra   salary invoice de...
3
4
5
6
7
8
9
10
11
      <!-- ****** Edit INVOICE ****** -->
      <v-dialog v-model="editInvoiceDialog">
        <v-card flat class="text-xs-center white--text">
          <v-layout>
            <v-flex xs12 class="card-styles pa-2">
              <label class="title text-xs-center">Edit Invoice</label>
              <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
88868752b   Neeraj Sharma   solve bugs add in...
12
          <editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" />
81d876b5d   Shikha Mishra   salary invoice de...
13
14
15
16
17
18
19
20
21
22
23
24
        </v-card>
      </v-dialog>
  
      <!-- ****PAYMENT INVOICE DIALOG -->
      <v-dialog v-model="paymentInvoiceDialog">
        <v-card flat class="text-xs-center white--text">
          <v-layout>
            <v-flex xs12 class="card-styles pa-2">
              <label class="title text-xs-center">Payment Template</label>
              <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
e03bf1f92   Neeraj Sharma   solved bugs add i...
25
          <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" />
81d876b5d   Shikha Mishra   salary invoice de...
26
27
28
29
        </v-card>
      </v-dialog>
  
      <!-- ****** PROFILE VIEW SECTION DATA ******  -->
c765369af   Neeraj Sharma   solve bugs
30

81d876b5d   Shikha Mishra   salary invoice de...
31
32
33
34
35
36
37
38
      <v-dialog v-model="dialog1" max-width="800px">
        <v-card flat class="text-xs-center white--text">
          <v-layout>
            <v-flex xs12 class="card-style pa-2">
              <label class="title text-xs-center">View Payments</label>
              <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon>
            </v-flex>
          </v-layout>
c62132b75   Shikha Mishra   invoice,progress-...
39
          <table class="feeTypeTable tableRsponsive">
81d876b5d   Shikha Mishra   salary invoice de...
40
41
42
43
44
45
46
47
            <tr style="color: black">
              <th>#</th>
              <th>Date</th>
              <th>Paid By</th>
              <th>Payment Amount</th>
              <th>Weaver</th>
              <th>Action</th>
            </tr>
c62132b75   Shikha Mishra   invoice,progress-...
48
            <tr v-if="editedItem.paymentStatus !== 'NOT_PAID'">
b9759239c   Shikha Mishra   shown invoice det...
49
50
51
              <td style="width:40px ; color:black" class="tdFeeType">1</td>
              <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td>
              <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td>
b3860f8e6   Shikha Mishra   improve delete fu...
52
              <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td>
b9759239c   Shikha Mishra   shown invoice det...
53
              <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td>
81d876b5d   Shikha Mishra   salary invoice de...
54
55
56
57
              <td class="text-xs-center td td-row">
                <router-link
                  :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }"
                >
c62132b75   Shikha Mishra   invoice,progress-...
58
                  <v-tooltip top>
81d876b5d   Shikha Mishra   salary invoice de...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
                    <img
                      slot="activator"
                      style="cursor:pointer; width:25px; height:25px; "
                      class="mr-3"
                      src="/static/icon/view.png"
                    />
                    <span>View</span>
                  </v-tooltip>
                </router-link>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer;width:20px; height:20px; "
                    class="mr-3"
b3860f8e6   Shikha Mishra   improve delete fu...
73
                    @click="deletePayment(editedItem)"
81d876b5d   Shikha Mishra   salary invoice de...
74
75
76
77
78
79
                    src="/static/icon/delete.png"
                  />
                  <span>Delete</span>
                </v-tooltip>
              </td>
            </tr>
b9759239c   Shikha Mishra   shown invoice det...
80
          </table>
68d742034   Neeraj Sharma   implement new des...
81
        </v-card>
81d876b5d   Shikha Mishra   salary invoice de...
82
      </v-dialog>
687e0b929   Neeraj Sharma   add user,attenden...
83

b9759239c   Shikha Mishra   shown invoice det...
84
      <!-- ****** Invoice Table ****** -->
68d742034   Neeraj Sharma   implement new des...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
      <v-toolbar color="transparent" flat>
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addInvoiceDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addInvoiceDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice
        </v-btn>
        <v-spacer></v-spacer>
        <v-card-title class="body-1" v-show="show">
          <v-btn icon large flat @click="displaySearch">
            <v-avatar size="27">
aa310d61a   Shikha Mishra   added functionali...
107
              <img src="/static/icon/search.png" alt="icon" />
68d742034   Neeraj Sharma   implement new des...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
            </v-avatar>
          </v-btn>
        </v-card-title>
        <v-flex xs8 sm8 md3 lg2 v-show="showSearch">
          <v-layout>
            <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field>
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="invoiceList"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <tr class="tr">
            <td class="td td-row">{{ props.index + 1 }}</td>
81d876b5d   Shikha Mishra   salary invoice de...
127
            <td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td>
68d742034   Neeraj Sharma   implement new des...
128
129
            <td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td>
            <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td>
c62132b75   Shikha Mishra   invoice,progress-...
130
            <td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td>
68d742034   Neeraj Sharma   implement new des...
131
132
133
134
135
            <td
              class="text-xs-center td td-row"
            >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td>
            <td
              class="text-xs-center td td-row"
81d876b5d   Shikha Mishra   salary invoice de...
136
            >{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td>
68d742034   Neeraj Sharma   implement new des...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
            <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'">
              <span
                class="red lighten-1 py-1 px-2 white--text paymentStatus"
              >{{ props.item.paymentStatus }}</span>
            </td>
            <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'">
              <span
                class="green lighten-1 py-1 px-2 white--text paymentStatus"
              >{{ props.item.paymentStatus }}</span>
            </td>
            <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'">
              <span
                class="yellow darken-3 py-1 px-2 white--text paymentStatus"
              >{{ props.item.paymentStatus }}</span>
            </td>
            <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td>
            <td class="text-xs-center td td-row">
aa310d61a   Shikha Mishra   added functionali...
154
              <router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }">
68d742034   Neeraj Sharma   implement new des...
155
156
157
158
159
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px; "
                    class="mr-3"
aa310d61a   Shikha Mishra   added functionali...
160
                    src="/static/icon/view.png"
68d742034   Neeraj Sharma   implement new des...
161
162
163
164
165
                  />
                  <span>View</span>
                </v-tooltip>
              </router-link>
              <span v-if="props.item.paymentStatus === 'NOT_PAID'">
c62132b75   Shikha Mishra   invoice,progress-...
166
167
168
169
170
171
172
173
174
175
176
177
                <!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }">
                  <v-tooltip top>
                    <img
                      slot="activator"
                      style="cursor:pointer; width:20px; height:18px; "
                      class="mr-3"
                      @click="editItem(props.item)"
                      src="/static/icon/edit.png"
                    />
                    <span>Edit</span>
                  </v-tooltip>
                </router-link>-->
81d876b5d   Shikha Mishra   salary invoice de...
178
179
180
181
182
183
184
185
186
187
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
                    src="/static/icon/edit.png"
                  />
                  <span>Edit</span>
                </v-tooltip>
68d742034   Neeraj Sharma   implement new des...
188
189
190
191
192
193
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer;width:20px; height:20px; "
                    class="mr-3"
                    @click="deleteItem(props.item)"
aa310d61a   Shikha Mishra   added functionali...
194
                    src="/static/icon/delete.png"
68d742034   Neeraj Sharma   implement new des...
195
196
197
                  />
                  <span>Delete</span>
                </v-tooltip>
81d876b5d   Shikha Mishra   salary invoice de...
198
199
200
201
202
203
204
205
206
207
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="paymentItem(props.item)"
                    src="/static/schoolIcons/Account.png"
                  />
                  <span>Payment</span>
                </v-tooltip>
68d742034   Neeraj Sharma   implement new des...
208
              </span>
81d876b5d   Shikha Mishra   salary invoice de...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
              <span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'">
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="paymentItem(props.item)"
                    src="/static/schoolIcons/Account.png"
                  />
                  <span>Payment</span>
                </v-tooltip>
              </span>
              <v-tooltip top>
                <img
                  slot="activator"
                  style="cursor:pointer; width:19px; height:19px;"
                  class="mr-3"
                  @click="profile(props.item)"
                  src="/static/icon/eye1.png"
                />
                <span>View Payment</span>
              </v-tooltip>
68d742034   Neeraj Sharma   implement new des...
231
232
233
234
235
236
237
238
239
240
            </td>
          </tr>
        </template>
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
      </v-data-table>
b9759239c   Shikha Mishra   shown invoice det...
241

68d742034   Neeraj Sharma   implement new des...
242
      <!-- ****** ADD INVOICE ****** -->
81d876b5d   Shikha Mishra   salary invoice de...
243
244
245
246
247
248
249
250
251
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
      <v-dialog v-model="addInvoiceDialog">
68d742034   Neeraj Sharma   implement new des...
252
253
        <v-card flat class="text-xs-center white--text">
          <v-layout>
81d876b5d   Shikha Mishra   salary invoice de...
254
255
            <v-flex xs12 class="card-styles pa-2">
              <label class="title text-xs-center">Add Invoice</label>
68d742034   Neeraj Sharma   implement new des...
256
257
258
259
260
261
262
263
264
265
              <v-icon size="24" class="right white--text" @click="addInvoiceDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-flex xs12 sm12>
            <v-container fluid grid-list-md>
              <v-layout wrap>
                <v-flex xs12 sm12 md5>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
81d876b5d   Shikha Mishra   salary invoice de...
266
                      <h3>Invoice</h3>
68d742034   Neeraj Sharma   implement new des...
267
268
269
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-form ref="form" v-model="valid" lazy-validation class="py-4">
687e0b929   Neeraj Sharma   add user,attenden...
270
                      <v-layout>
68d742034   Neeraj Sharma   implement new des...
271
272
273
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
687e0b929   Neeraj Sharma   add user,attenden...
274
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
275
276
277
278
279
280
281
282
283
284
285
                        <v-flex xs6 class="ml-3">
                          <v-select
                            :items="addclass"
                            label="Select Class"
                            v-model="invoiceData.classNum"
                            item-text="classNum"
                            item-value="_id"
                            @change="getAllStudents()"
                            :rules="classRules"
                            required
                          ></v-select>
687e0b929   Neeraj Sharma   add user,attenden...
286
287
288
                        </v-flex>
                      </v-layout>
                      <v-layout>
68d742034   Neeraj Sharma   implement new des...
289
290
291
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right hidden-xs-only hidden-sm-only">Select Student:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label>
687e0b929   Neeraj Sharma   add user,attenden...
292
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
293
294
295
296
297
298
299
300
301
302
303
                        <v-flex xs6 class="ml-3">
                          <v-select
                            :items="studentList"
                            label="Select Student"
                            v-model="invoiceData.studentId"
                            item-text="name"
                            item-value="_id"
                            :rules="inchargeRules"
                            @change="selectAllStudent()"
                            required
                          ></v-select>
687e0b929   Neeraj Sharma   add user,attenden...
304
305
306
                        </v-flex>
                      </v-layout>
                      <v-layout>
68d742034   Neeraj Sharma   implement new des...
307
308
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Date:</label>
687e0b929   Neeraj Sharma   add user,attenden...
309
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
                        <v-flex xs6 class="ml-3">
                          <v-menu
                            ref="menu1"
                            :close-on-content-click="false"
                            v-model="menu1"
                            :nudge-right="40"
                            lazy
                            :return-value.sync="invoiceData.date"
                            transition="scale-transition"
                            offset-y
                            full-width
                            min-width="290px"
                          >
                            <v-text-field
                              slot="activator"
                              :rules="dateRules"
                              v-model="invoiceData.date"
                              placeholder="Select date"
                            ></v-text-field>
                            <v-date-picker
                              v-model="invoiceData.date"
                              @input="$refs.menu1.save(invoiceData.date)"
                            ></v-date-picker>
                          </v-menu>
687e0b929   Neeraj Sharma   add user,attenden...
334
335
336
                        </v-flex>
                      </v-layout>
                      <v-layout>
68d742034   Neeraj Sharma   implement new des...
337
338
339
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label>
687e0b929   Neeraj Sharma   add user,attenden...
340
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
341
342
343
344
345
346
347
348
349
350
351
                        <v-flex xs6 class="ml-3">
                          <v-select
                            :items="paymentStatus"
                            v-model="invoiceData.paymentStatus"
                            item-text="name"
                            item-value="value"
                            label="Select Payment Status"
                            @change="getPayMethodList"
                            :rules="paymentStatusRules"
                            required
                          ></v-select>
687e0b929   Neeraj Sharma   add user,attenden...
352
353
                        </v-flex>
                      </v-layout>
68d742034   Neeraj Sharma   implement new des...
354
355
356
                      <v-layout v-show="showPayMethods">
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Payment Method:</label>
687e0b929   Neeraj Sharma   add user,attenden...
357
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
358
                        <v-flex xs6 class="ml-3">
687e0b929   Neeraj Sharma   add user,attenden...
359
                          <v-select
68d742034   Neeraj Sharma   implement new des...
360
361
                            :items="paymentMethods"
                            v-model="invoiceData.paymentMethod"
728b5d417   Neeraj Sharma   solve bugs in add...
362
                            :rules="paymentMethodRules"
68d742034   Neeraj Sharma   implement new des...
363
364
                            label="Select Payment Method"
                            required
687e0b929   Neeraj Sharma   add user,attenden...
365
366
                          ></v-select>
                        </v-flex>
68d742034   Neeraj Sharma   implement new des...
367
368
369
370
371
372
                      </v-layout>
                      <v-layout>
                        <v-flex xs12 sm11>
                          <v-card-actions>
                            <v-spacer></v-spacer>
                            <v-btn @click="clear" round dark class="clear-button">clear</v-btn>
81d876b5d   Shikha Mishra   salary invoice de...
373
374
375
376
377
378
379
                            <v-btn
                              @click="submit"
                              round
                              dark
                              :loading="loading"
                              class="add-button"
                            >Add</v-btn>
68d742034   Neeraj Sharma   implement new des...
380
                          </v-card-actions>
687e0b929   Neeraj Sharma   add user,attenden...
381
382
                        </v-flex>
                      </v-layout>
68d742034   Neeraj Sharma   implement new des...
383
384
385
386
387
                    </v-form>
                  </v-card>
                </v-flex>
                <v-flex xs12 sm12 md7>
                  <v-card>
81d876b5d   Shikha Mishra   salary invoice de...
388
                    <v-toolbar dark class="card-styles" flat>
68d742034   Neeraj Sharma   implement new des...
389
                      <v-spacer></v-spacer>
81d876b5d   Shikha Mishra   salary invoice de...
390
                      <h3>Fee Type List</h3>
68d742034   Neeraj Sharma   implement new des...
391
392
393
394
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout>
                      <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only">
81d876b5d   Shikha Mishra   salary invoice de...
395
                        <label class="right title">Fee Type:</label>
68d742034   Neeraj Sharma   implement new des...
396
397
398
399
400
401
402
403
                      </v-flex>
                      <v-flex xs8 sm4>
                        <v-select
                          :items="feeTypes"
                          v-model="feeType.feeTypeName"
                          item-text="feeType"
                          item-value="feeType"
                          label="Select Fee Type"
81d876b5d   Shikha Mishra   salary invoice de...
404
                          required
68d742034   Neeraj Sharma   implement new des...
405
406
407
                        ></v-select>
                      </v-flex>
                      <v-flex xs4 sm6>
81d876b5d   Shikha Mishra   salary invoice de...
408
409
410
411
412
413
414
                        <v-btn
                          color="open-dialog-button"
                          round
                          dark
                          class="right mt-3"
                          @click="selectFeeType"
                        >ADD</v-btn>
68d742034   Neeraj Sharma   implement new des...
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
                      </v-flex>
                    </v-layout>
                    <table class="feeTypeTable tableRsponsive">
                      <tr class="info white--text">
                        <th>#</th>
                        <th>Fee Type</th>
                        <th>Amount</th>
                        <th>Discount(%)</th>
                        <th>Subtotal</th>
                        <th>Paid Amount</th>
                        <th>Action</th>
                      </tr>
                      <tr
                        v-show="showFeeType"
                        v-for="(feeType, index) in feeTypeData"
                        :key="index"
                        v-on:keyup="getAmmountDetails(feeType)"
                      >
                        <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td>
81d876b5d   Shikha Mishra   salary invoice de...
434
435
436
437
438
                        <td
                          style="width:120px"
                          class="tdFeeType"
                          :rules="feeTypeNameRules"
                        >{{ feeType.feeTypeName }}</td>
68d742034   Neeraj Sharma   implement new des...
439
440
441
442
443
                        <td class="tdFeeType">
                          <v-text-field
                            placeholder="fill your Amount"
                            v-model="feeType.amount"
                            type="number"
81d876b5d   Shikha Mishra   salary invoice de...
444
445
                            :rules="amountRules"
                            required
68d742034   Neeraj Sharma   implement new des...
446
447
448
449
450
451
452
                          ></v-text-field>
                        </td>
                        <td class="tdFeeType">
                          <v-text-field
                            placeholder="fill your Discount"
                            v-model="feeType.discount"
                            type="number"
81d876b5d   Shikha Mishra   salary invoice de...
453
454
                            :rules="discountRules"
                            required
68d742034   Neeraj Sharma   implement new des...
455
456
                          ></v-text-field>
                        </td>
81d876b5d   Shikha Mishra   salary invoice de...
457
458
                        <td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td>
                        <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'">
68d742034   Neeraj Sharma   implement new des...
459
460
461
462
463
464
                          <v-text-field
                            placeholder="fill your Paid Amount"
                            v-model="feeType.paidAmount"
                            type="number"
                            :disabled="disabled"
                          ></v-text-field>
81d876b5d   Shikha Mishra   salary invoice de...
465
                        </td>
68d742034   Neeraj Sharma   implement new des...
466
467
468
469
470
471
472
473
474
475
476
                        <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''">
                          <v-text-field
                            placeholder="fill your Paid Amount"
                            v-model="feeType.paidAmount"
                            type="number"
                            :disabled="disabled"
                          ></v-text-field>
                        </td>
                        <td
                          class="tdFeeType"
                          v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''"
687e0b929   Neeraj Sharma   add user,attenden...
477
                        >
68d742034   Neeraj Sharma   implement new des...
478
479
480
481
482
483
484
                          <v-text-field
                            placeholder="fill your Paid Amount"
                            v-model="feeType.paidAmount"
                            type="number"
                          ></v-text-field>
                        </td>
                        <td class="tdFeeType">
11f495070   Neeraj Sharma   all solve bugs ed...
485
                          <v-icon color="error" @click="deleteSelectFee(index,feeType)">delete</v-icon>
68d742034   Neeraj Sharma   implement new des...
486
487
488
489
490
                        </td>
                      </tr>
                      <tfoot>
                        <tr>
                          <td colspan="2" class="tdFeeType">Total:</td>
b9759239c   Shikha Mishra   shown invoice det...
491
492
493
494
                          <td class="tdFeeType">{{ feeType.amount }}</td>
                          <td class="tdFeeType">{{ feeType.discount }}</td>
                          <td class="tdFeeType">{{ feeType.subTotal }}</td>
                          <td class="tdFeeType">{{ feeType.paidAmount }}</td>
11f495070   Neeraj Sharma   all solve bugs ed...
495
                          <!-- <td class="tdFeeType">
81d876b5d   Shikha Mishra   salary invoice de...
496
                            <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon>
11f495070   Neeraj Sharma   all solve bugs ed...
497
                          </td>-->
687e0b929   Neeraj Sharma   add user,attenden...
498
                        </tr>
68d742034   Neeraj Sharma   implement new des...
499
500
501
502
503
504
505
506
507
                      </tfoot>
                    </table>
                  </v-card>
                </v-flex>
              </v-layout>
            </v-container>
          </v-flex>
        </v-card>
      </v-dialog>
687e0b929   Neeraj Sharma   add user,attenden...
508
509
510
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
511
    </v-container>
687e0b929   Neeraj Sharma   add user,attenden...
512
513
514
515
  </template>
  
  <script>
  import http from "@/Services/http.js";
88868752b   Neeraj Sharma   solve bugs add in...
516
  import editInvoice from "./editInvoice";
3e79b2f9f   Neeraj Sharma   implement functio...
517
  import paymentTemplate from "./paymentTemplate.vue";
687e0b929   Neeraj Sharma   add user,attenden...
518
519
520
  import moment from "moment";
  
  export default {
88868752b   Neeraj Sharma   solve bugs add in...
521
    components: {
3e79b2f9f   Neeraj Sharma   implement functio...
522
523
      editInvoice: editInvoice,
      paymentTemplate: paymentTemplate
88868752b   Neeraj Sharma   solve bugs add in...
524
    },
687e0b929   Neeraj Sharma   add user,attenden...
525
526
527
528
529
530
    data: () => ({
      snackbar: false,
      showPayMethods: false,
      y: "top",
      x: "right",
      mode: "",
d9bb52b5b   Neeraj Sharma   implement trello ...
531
      timeout: 5000,
687e0b929   Neeraj Sharma   add user,attenden...
532
      text: "",
d9bb52b5b   Neeraj Sharma   implement trello ...
533
      color: "",
68d742034   Neeraj Sharma   implement new des...
534
535
      show: true,
      showSearch: false,
687e0b929   Neeraj Sharma   add user,attenden...
536
537
538
539
540
541
542
543
544
545
      showLoader: false,
      loading: false,
      date: null,
      search: "",
      dialog: false,
      dialog1: false,
      valid: true,
      validEdit: true,
      isActive: true,
      newActive: false,
b9759239c   Shikha Mishra   shown invoice det...
546
      showFeeType: true,
68d742034   Neeraj Sharma   implement new des...
547
      addInvoiceDialog: false,
81d876b5d   Shikha Mishra   salary invoice de...
548
549
      editInvoiceDialog: false,
      paymentInvoiceDialog: false,
687e0b929   Neeraj Sharma   add user,attenden...
550
551
552
      disabled: true,
      details: [],
      feeTypes: [],
81d876b5d   Shikha Mishra   salary invoice de...
553
      invoiceData: [],
879451281   Shikha Mishra   improve update in...
554
      editData: [],
b9759239c   Shikha Mishra   shown invoice det...
555
      invoiceList: [],
879451281   Shikha Mishra   improve update in...
556
557
      editPayment: {
        studentId: {
c62132b75   Shikha Mishra   invoice,progress-...
558
559
          name: "",
          rollNo: ""
879451281   Shikha Mishra   improve update in...
560
561
        },
        classId: {
c62132b75   Shikha Mishra   invoice,progress-...
562
          classNum: ""
879451281   Shikha Mishra   improve update in...
563
564
        }
      },
687e0b929   Neeraj Sharma   add user,attenden...
565
566
567
568
569
      menu1: false,
      paymentMethods: ["Cash", "Cheque"],
      feeType: {
        amount: "0.00",
        discount: "0.00",
687e0b929   Neeraj Sharma   add user,attenden...
570
        subTotal: "0.00",
6df6faccd   Rishav Singla   design changes
571
        paidAmount: "0.00",
687e0b929   Neeraj Sharma   add user,attenden...
572
573
        feeTypeName: ""
      },
c62132b75   Shikha Mishra   invoice,progress-...
574

687e0b929   Neeraj Sharma   add user,attenden...
575
      feeTypeData: [],
88868752b   Neeraj Sharma   solve bugs add in...
576
577
      editFeeTypeData: [],
      paymentFeeTypeData: [],
687e0b929   Neeraj Sharma   add user,attenden...
578
      pagination: {
68d742034   Neeraj Sharma   implement new des...
579
        rowsPerPage: 10
687e0b929   Neeraj Sharma   add user,attenden...
580
581
582
583
584
      },
      classRules: [v => !!v || " Class Name is required"],
      inchargeRules: [v => !!v || "Student Name is required"],
      dateRules: [v => !!v || " Date is required"],
      paymentStatusRules: [v => !!v || "Payment Status is required"],
6ae46ca27   Neeraj Sharma   implement upload ...
585
      paymentMethodsRules: [v => !!v || "payment Method is required"],
81d876b5d   Shikha Mishra   salary invoice de...
586
587
588
589
590
591
592
      feeTypeRules: [v => !!v || "Fee Type  is required"],
      feeTypeNameRules: [v => !!v || "Fee Type Name is required"],
      amountRules: [v => !!v || "Amount is required"],
      discountRules: [v => !!v || "Discount is required"],
      subtotalRules: [v => !!v || "Subtotal is required"],
      paymentRules: [v => !!v || "Payment is required"],
      paidAmountRules: [v => !!v || "Paid Amount is required"],
728b5d417   Neeraj Sharma   solve bugs in add...
593
      paymentMethodRules: [],
687e0b929   Neeraj Sharma   add user,attenden...
594
595
596
      headers: [
        {
          text: "No",
68d742034   Neeraj Sharma   implement new des...
597
          align: "",
687e0b929   Neeraj Sharma   add user,attenden...
598
599
600
          sortable: false,
          value: "No"
        },
81d876b5d   Shikha Mishra   salary invoice de...
601
602
603
604
605
606
        {
          text: "Student",
          value: "name",
          sortable: false,
          align: "center"
        },
687e0b929   Neeraj Sharma   add user,attenden...
607
608
        { text: "Class", value: "class", sortable: false, align: "center" },
        { text: "Total", value: "subtotal", sortable: false, align: "center" },
c62132b75   Shikha Mishra   invoice,progress-...
609
610
611
612
613
614
        {
          text: "Discount(%)",
          value: "discount",
          sortable: false,
          align: "center"
        },
687e0b929   Neeraj Sharma   add user,attenden...
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
        {
          text: "Paid Amount",
          value: "paidAmount",
          sortable: false,
          align: "center"
        },
        {
          text: "Balance",
          value: "Balance",
          sortable: false,
          align: "center"
        },
        {
          text: "Status",
          value: "paymentStatus",
          sortable: false,
          align: "center"
        },
        {
          text: "Date",
          value: "date",
          sortable: false,
          align: "center"
        },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
b9759239c   Shikha Mishra   shown invoice det...
641

81d876b5d   Shikha Mishra   salary invoice de...
642
643
644
      studentId: {
        name: ""
      },
687e0b929   Neeraj Sharma   add user,attenden...
645
646
647
      token: "",
      editedItem: {},
      invoiceData: {
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
648
649
        paymentStatus: "",
        students: []
687e0b929   Neeraj Sharma   add user,attenden...
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
      },
      addclass: [],
      studentList: [],
      paymentStatus: [
        {
          name: "Not Paid",
          value: "NOT_PAID"
        },
        {
          name: "Partially Paid",
          value: "PARTIALLY_PAID"
        },
        {
          name: "Fully Paid",
          value: "FULLY_PAID"
        }
      ]
    }),
    methods: {
      save(date) {
        this.$refs.menu1.save(date);
      },
      dates: function(date) {
        return moment(date).format("MMMM DD, YYYY");
      },
81d876b5d   Shikha Mishra   salary invoice de...
675
      profile(item) {
b9759239c   Shikha Mishra   shown invoice det...
676
        // console.log("item", item);
81d876b5d   Shikha Mishra   salary invoice de...
677
        this.editedIndex = this.invoiceList.indexOf(item);
da153da77   Neeraj Sharma   solved issued vie...
678
        this.editedItem = Object.assign({}, item);
88868752b   Neeraj Sharma   solve bugs add in...
679
        console.log("editedItem", this.editedItem);
81d876b5d   Shikha Mishra   salary invoice de...
680
681
682
683
        this.dialog1 = true;
      },
      editItem(item) {
        this.editedIndex = this.invoiceList.indexOf(item);
879451281   Shikha Mishra   improve update in...
684
        this.editData = Object.assign({}, item);
88868752b   Neeraj Sharma   solve bugs add in...
685
686
687
        this.editData.date = this.editData.date.slice(0, 10);
        // console.log("invoiceData", this.editData);
        this.editFeeTypeData = this.editData.feeType;
81d876b5d   Shikha Mishra   salary invoice de...
688
689
690
        this.editInvoiceDialog = true;
      },
      paymentItem(item) {
879451281   Shikha Mishra   improve update in...
691
        // console.log("item", item);
81d876b5d   Shikha Mishra   salary invoice de...
692
        this.editedIndex = this.invoiceList.indexOf(item);
b9759239c   Shikha Mishra   shown invoice det...
693
        this.editPayment = Object.assign({}, item);
3e79b2f9f   Neeraj Sharma   implement functio...
694
        this.editPayment.date = this.editPayment.date.slice(0, 10);
c765369af   Neeraj Sharma   solve bugs
695
696
697
698
699
700
        if (this.editPayment.paymentStatus == "NOT_PAID") {
          for (let i = 0; i < this.editPayment.feeType.length; i++) {
            this.editPayment.feeType[i].paidAmount = "0.00";
          }
        }
        // console.log("this.editPayment", this.editPayment);
88868752b   Neeraj Sharma   solve bugs add in...
701
        this.paymentFeeTypeData = this.editPayment.feeType;
81d876b5d   Shikha Mishra   salary invoice de...
702
703
        this.paymentInvoiceDialog = true;
      },
687e0b929   Neeraj Sharma   add user,attenden...
704
705
706
707
708
709
710
711
712
713
714
715
      deleteItem(item) {
        let deleteInvoice = {
          invoiceId: item._id
        };
        http()
          .delete(
            "/deleteInvoice",
            confirm("Are you sure you want to delete this?") && {
              params: deleteInvoice
            }
          )
          .then(response => {
d9bb52b5b   Neeraj Sharma   implement trello ...
716
717
            this.snackbar = true;
            this.text = "Successfully delete Existing Invoice";
b3860f8e6   Shikha Mishra   improve delete fu...
718
719
720
721
722
723
724
725
726
727
728
729
730
            this.color = "green";
            this.dialog1 = false;
            this.getInvoiceList();
          })
          .catch(error => {
            // console.log(error);
          });
      },
      deletePayment(editedItem) {
        let deleteInvoice = {
          invoiceId: editedItem._id
        };
        http()
c62132b75   Shikha Mishra   invoice,progress-...
731
732
733
734
735
736
737
          .put(
            "/removePayment",
            deleteInvoice,
            confirm("Are you sure you want to delete this?") && {
              headers: {
                Authorization: "Bearer " + this.token
              }
b3860f8e6   Shikha Mishra   improve delete fu...
738
            }
c62132b75   Shikha Mishra   invoice,progress-...
739
          )
b3860f8e6   Shikha Mishra   improve delete fu...
740
741
742
          .then(response => {
            this.snackbar = true;
            this.text = "Successfully delete Existing Invoice";
d9bb52b5b   Neeraj Sharma   implement trello ...
743
            this.color = "green";
81d876b5d   Shikha Mishra   salary invoice de...
744
            this.dialog1 = false;
687e0b929   Neeraj Sharma   add user,attenden...
745
746
747
748
749
750
            this.getInvoiceList();
          })
          .catch(error => {
            // console.log(error);
          });
      },
687e0b929   Neeraj Sharma   add user,attenden...
751
752
      close() {
        this.dialog = false;
687e0b929   Neeraj Sharma   add user,attenden...
753
      },
d9bb52b5b   Neeraj Sharma   implement trello ...
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
      // totalAmount() {
      //   // console.log("this.feeType.paidAmount ", this.feeType.paidAmount);
      //   // console.log(
      //   //   "this.feeType.subTotalAAAAAAAAAAAAAAA ",
      //   //   this.feeType.subTotal
      //   // );
  
      //   if (this.feeType.paidAmount < this.feeType.subTotal) {
      //     console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal);
  
      //     this.feeType.paidAmount = this.feeType.subTotal;
      //     console.log(
      //       "this.feeType.paidAmount BBBBBBBBBBB",
      //       this.feeType.paidAmount
      //     );
      //   }
      // },
687e0b929   Neeraj Sharma   add user,attenden...
771
772
773
774
775
776
777
      submit() {
        let feeTypeId = "";
        for (let i = 0; i < this.feeTypes.length; i++) {
          if (this.feeTypes[i].feeType === this.feeType.feeTypeName) {
            feeTypeId = this.feeTypes[i]._id;
          }
        }
88868752b   Neeraj Sharma   solve bugs add in...
778
779
780
781
782
783
784
785
        if (this.$refs.form.validate()) {
          let invoiceData = {
            classId: this.invoiceData.classNum,
            students: this.invoiceData.students,
            date: this.invoiceData.date,
            paymentStatus: this.invoiceData.paymentStatus,
            paymentMethod: this.invoiceData.paymentMethod,
            feeType: this.feeTypeData,
c765369af   Neeraj Sharma   solve bugs
786
787
            totalAmount: this.feeType.amount.toString(),
            totalDiscount: this.feeType.discount.toString(),
11f495070   Neeraj Sharma   all solve bugs ed...
788
            totalSubTotal: this.feeType.subTotal.toString(),
88868752b   Neeraj Sharma   solve bugs add in...
789
790
            totalPaidAmount: this.feeType.paidAmount
          };
11f495070   Neeraj Sharma   all solve bugs ed...
791
792
793
794
  
          if (invoiceData.paymentStatus == "NOT_PAID") {
            delete invoiceData.paymentMethod;
          }
c765369af   Neeraj Sharma   solve bugs
795
796
797
          if (this.feeType.paidAmount != "0.00") {
            if (this.feeType.subTotal == this.feeType.paidAmount) {
              invoiceData.paymentStatus = "FULLY_PAID";
d650dbf7d   Neeraj Sharma   edit invoice issu...
798
              // console.log("FULLY_PAID");
c765369af   Neeraj Sharma   solve bugs
799
800
801
802
            }
            if (invoiceData.totalPaidAmount) {
              if (this.feeType.subTotal != this.feeType.paidAmount) {
                invoiceData.paymentStatus = "PARTIALLY_PAID";
d650dbf7d   Neeraj Sharma   edit invoice issu...
803
                // console.log("PARTIALLY_PAID");
c765369af   Neeraj Sharma   solve bugs
804
              }
e03bf1f92   Neeraj Sharma   solved bugs add i...
805
            }
11f495070   Neeraj Sharma   all solve bugs ed...
806
807
808
809
810
811
812
813
814
          }
  
          if (invoiceData.totalSubTotal == "0.00") {
            invoiceData.paymentStatus = "FULLY_PAID";
          } else if (invoiceData.totalSubTotal != "0.00") {
            if (this.feeType.paidAmount === "0.00") {
              invoiceData.paymentStatus = "NOT_PAID";
              delete invoiceData.paymentMethod;
            }
e03bf1f92   Neeraj Sharma   solved bugs add i...
815
          }
88868752b   Neeraj Sharma   solve bugs add in...
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
          http()
            .post("/createInvoice", invoiceData)
            .then(response => {
              this.getInvoiceList();
              this.snackbar = true;
              this.text = "New Invoice added successfully";
              this.color = "green";
              this.clear();
              this.feeTypeData = [];
              if (this.feeTypeData.length == 0) {
                this.feeType = {
                  amount: "0.00",
                  discount: "0.00",
                  paidAmount: "0.00",
                  subTotal: "0.00",
                  feeTypeList: ""
                };
              }
              this.loading = false;
              this.addInvoiceDialog = false;
            })
            .catch(error => {
              this.snackbar = true;
              this.text = error.response.data.errors[0].messages[0];
              this.color = "error";
              this.loading = false;
            });
81d876b5d   Shikha Mishra   salary invoice de...
843
        }
81d876b5d   Shikha Mishra   salary invoice de...
844
      },
687e0b929   Neeraj Sharma   add user,attenden...
845
846
847
848
      clear() {
        this.$refs.form.reset();
      },
      getInvoiceList() {
6ae46ca27   Neeraj Sharma   implement upload ...
849
        this.showLoader = true;
687e0b929   Neeraj Sharma   add user,attenden...
850
851
        http()
          .get("/getInvoicesList", {
99cd79184   Neeraj Sharma   implement all tas...
852
            params: { schoolId: this.$store.state.schoolId },
687e0b929   Neeraj Sharma   add user,attenden...
853
854
855
856
857
858
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.invoiceList = response.data.data;
            this.showLoader = false;
          })
ab54b5656   Neeraj Sharma   implement library...
859
          .catch(error => {
687e0b929   Neeraj Sharma   add user,attenden...
860
861
862
863
864
865
866
867
868
869
870
871
            // console.log("err====>", err);
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      selectFeeType() {
        this.showFeeType = true;
        this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName });
687e0b929   Neeraj Sharma   add user,attenden...
872
      },
11f495070   Neeraj Sharma   all solve bugs ed...
873
874
      deleteSelectFee: function(index, feeTyp) {
        console.log("---index----", index);
687e0b929   Neeraj Sharma   add user,attenden...
875
        this.feeTypeData.splice(index, 1);
11f495070   Neeraj Sharma   all solve bugs ed...
876
        this.getAmmountDetails(feeTyp);
687e0b929   Neeraj Sharma   add user,attenden...
877
878
879
880
881
882
883
884
885
886
887
888
889
        if (this.feeTypeData.length == 0) {
          this.feeType = {
            amount: "0.00",
            discount: "0.00",
            paidAmount: "0.00",
            subTotal: "0.00",
            feeTypeName: ""
          };
        }
      },
      getAllClasses() {
        http()
          .get("/getClassesList", {
99cd79184   Neeraj Sharma   implement all tas...
890
            params: { schoolId: this.$store.state.schoolId },
687e0b929   Neeraj Sharma   add user,attenden...
891
892
893
894
895
896
897
898
899
900
901
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.addclass = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
            // this.$router.replace({ path: "/" });
          });
      },
      getAllStudents() {
d9bb52b5b   Neeraj Sharma   implement trello ...
902
        this.showLoader = true;
687e0b929   Neeraj Sharma   add user,attenden...
903
904
        http()
          .get("/getStudentsList", {
99cd79184   Neeraj Sharma   implement all tas...
905
906
907
908
            params: {
              classId: this.invoiceData.classNum,
              schoolId: this.$store.state.schoolId
            },
687e0b929   Neeraj Sharma   add user,attenden...
909
910
911
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
912
913
914
915
            response.data.data.unshift({
              name: "Select All",
              _id: "Select All"
            });
687e0b929   Neeraj Sharma   add user,attenden...
916
            this.studentList = response.data.data;
d9bb52b5b   Neeraj Sharma   implement trello ...
917
            this.showLoader = false;
687e0b929   Neeraj Sharma   add user,attenden...
918
919
          })
          .catch(err => {
d9bb52b5b   Neeraj Sharma   implement trello ...
920
            this.showLoader = false;
687e0b929   Neeraj Sharma   add user,attenden...
921
922
923
924
925
926
927
            // console.log("err====>", err);
            // this.$router.replace({ path: "/" });
          });
      },
      getfeeType() {
        http()
          .get("/getFeesList", {
99cd79184   Neeraj Sharma   implement all tas...
928
929
930
            params: {
              schoolId: this.$store.state.schoolId
            },
687e0b929   Neeraj Sharma   add user,attenden...
931
932
933
934
935
936
937
938
939
940
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.feeTypes = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
            // this.$router.replace({ path: "/" });
          });
      },
c62132b75   Shikha Mishra   invoice,progress-...
941

e03bf1f92   Neeraj Sharma   solved bugs add i...
942
      getAmmountDetails(feeTyp) {
687e0b929   Neeraj Sharma   add user,attenden...
943
        let feeType = {
de5a79260   Neeraj Sharma   solve bugs empty ...
944
945
946
947
          amount: "0.00",
          discount: "0.00",
          subTotal: "0.00",
          subParticularTotal: "0.00",
687e0b929   Neeraj Sharma   add user,attenden...
948
949
950
951
          paidAmount: ""
        };
        for (let i = 0; i < this.feeTypeData.length; i++) {
          // *********** AMOUNT ***********
c765369af   Neeraj Sharma   solve bugs
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
          if (this.feeTypeData[i].amount) {
            feeType.amount =
              Number(feeType.amount) + Number(this.feeTypeData[i].amount);
            this.feeType.amount = feeType.amount;
            this.feeType.subTotal = feeType.amount;
            this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
          } else if (this.feeTypeData[0].amount == "") {
            this.feeType.amount = "0.00";
            this.feeTypeData[i].subTotal = "0.00";
            this.feeType.subTotal = "0.00";
          } else if (this.feeTypeData[i].amount == "") {
            this.feeType.amount =
              Number(feeType.amount) + Number(this.feeTypeData[i].amount);
            this.feeTypeData[i].subTotal =
              Number(feeType.amount) + Number(this.feeTypeData[i].amount);
            this.feeType.subTotal =
              Number(feeType.amount) + Number(this.feeTypeData[i].amount);
          }
687e0b929   Neeraj Sharma   add user,attenden...
970
          // *********** DISCOUNT ***********
de5a79260   Neeraj Sharma   solve bugs empty ...
971
          if (this.feeTypeData[i].discount) {
11f495070   Neeraj Sharma   all solve bugs ed...
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
            if (Number(this.feeTypeData[i].discount) < 100) {
              feeType.discount =
                Number(feeType.discount) + Number(this.feeTypeData[i].discount);
              this.feeType.discount = feeType.discount;
              feeType.subParticularTotal =
                this.feeTypeData[i].amount -
                (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
              this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(
                2
              );
            } else if (Number(this.feeTypeData[i].discount) >= 100) {
              this.feeTypeData[i].discount = "100";
              feeType.discount =
                Number(feeType.discount) + Number(this.feeTypeData[i].discount);
              this.feeType.discount = feeType.discount.toString();
              feeType.subParticularTotal =
                this.feeTypeData[i].amount -
                (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
              this.feeTypeData[
                i
              ].subTotal = feeType.subParticularTotal.toString();
            }
c765369af   Neeraj Sharma   solve bugs
994
995
996
997
998
          } else if (this.feeTypeData[0].discount == "") {
            this.feeType.discount = "0.00";
          } else if (this.feeTypeData[i].discount == "") {
            this.feeType.discount =
              Number(feeType.discount) + Number(this.feeTypeData[i].discount);
de5a79260   Neeraj Sharma   solve bugs empty ...
999
          }
687e0b929   Neeraj Sharma   add user,attenden...
1000
1001
  
          // *********** SUBTOTAL ***********
c765369af   Neeraj Sharma   solve bugs
1002
1003
1004
1005
1006
          if (this.feeTypeData[i].subTotal) {
            feeType.subTotal =
              Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
            this.feeType.subTotal = feeType.subTotal.toFixed(2);
          }
687e0b929   Neeraj Sharma   add user,attenden...
1007
1008
  
          // *********** PAID-AMOUNT ***********
de5a79260   Neeraj Sharma   solve bugs empty ...
1009
1010
1011
1012
          if (this.feeTypeData[i].paidAmount) {
            feeType.paidAmount =
              Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
            this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
c765369af   Neeraj Sharma   solve bugs
1013
1014
1015
1016
1017
          } else if (this.feeTypeData[0].paidAmount == "") {
            this.feeType.paidAmount = "0.00";
          } else if (this.feeTypeData[i].paidAmount == "") {
            this.feeType.paidAmount = feeType.paidAmount =
              Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
de5a79260   Neeraj Sharma   solve bugs empty ...
1018
          }
c765369af   Neeraj Sharma   solve bugs
1019

d9bb52b5b   Neeraj Sharma   implement trello ...
1020
1021
1022
1023
1024
          // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value.
          if (feeType.paidAmount > feeType.subTotal) {
            this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal;
            this.feeType.paidAmount = feeType.subTotal;
          }
687e0b929   Neeraj Sharma   add user,attenden...
1025
1026
1027
1028
1029
        }
      },
      getPayMethodList() {
        if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") {
          this.showPayMethods = true;
728b5d417   Neeraj Sharma   solve bugs in add...
1030
          this.paymentMethodRules = [v => !!v || "Payment Method is required"];
687e0b929   Neeraj Sharma   add user,attenden...
1031
1032
        } else if (this.invoiceData.paymentStatus == "FULLY_PAID") {
          this.showPayMethods = true;
728b5d417   Neeraj Sharma   solve bugs in add...
1033
          this.paymentMethodRules = [v => !!v || "Payment Method is required"];
c765369af   Neeraj Sharma   solve bugs
1034
1035
1036
1037
1038
        } else if (this.invoiceData.paymentStatus == "NOT_PAID") {
          for (let i = 0; i < this.feeTypeData.length; i++) {
            this.feeTypeData[i].paidAmount = "0.00";
            this.feeType.paidAmount = "0.00";
          }
728b5d417   Neeraj Sharma   solve bugs in add...
1039
1040
          this.paymentMethodRules = "";
          this.showPayMethods = false;
879451281   Shikha Mishra   improve update in...
1041
1042
1043
1044
        } else {
          this.showPayMethods = false;
        }
      },
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
1045
      selectAllStudent() {
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
        this.invoiceData.students = [];
        if (this.invoiceData.studentId === "Select All") {
          for (let i = 1; i < this.studentList.length; i++) {
            this.invoiceData.students.push(this.studentList[i]._id);
            console.log("data", this.invoiceData.students);
            // data.push(this.studentList[i]._id);
            // console.log("data", data);
          }
        } else {
          this.invoiceData.students.push(this.invoiceData.studentId);
        }
68d742034   Neeraj Sharma   implement new des...
1057
1058
      },
      displaySearch() {
c765369af   Neeraj Sharma   solve bugs
1059
1060
        this.show = false;
        this.showSearch = true;
68d742034   Neeraj Sharma   implement new des...
1061
1062
1063
1064
1065
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
88868752b   Neeraj Sharma   solve bugs add in...
1066
1067
1068
1069
      },
      updateDoneInvoice() {
        this.editInvoiceDialog = false;
        this.getInvoiceList();
e03bf1f92   Neeraj Sharma   solved bugs add i...
1070
1071
1072
1073
1074
1075
1076
      },
      updatePayment() {
        this.paymentInvoiceDialog = false;
        this.getInvoiceList();
        this.snackbar = true;
        this.text = "Payment added successfully";
        this.color = "green";
687e0b929   Neeraj Sharma   add user,attenden...
1077
1078
1079
1080
1081
1082
1083
      }
    },
    mounted() {
      this.token = this.$store.state.token;
      this.getInvoiceList();
      this.getAllClasses();
      this.getfeeType();
81d876b5d   Shikha Mishra   salary invoice de...
1084
      this.getAllStudents();
687e0b929   Neeraj Sharma   add user,attenden...
1085
1086
1087
1088
1089
1090
    }
  };
  </script>
  
  
  <style scoped>
687e0b929   Neeraj Sharma   add user,attenden...
1091
1092
1093
1094
1095
1096
  table {
    border-collapse: collapse;
    border: 1px solid #e2e7eb;
  }
  
  th,
68d742034   Neeraj Sharma   implement new des...
1097
  .tdFeeType {
687e0b929   Neeraj Sharma   add user,attenden...
1098
1099
1100
1101
1102
1103
1104
1105
1106
    border: 1px solid #e2e7eb;
    padding: 10px;
    text-align: center;
  }
  table.feeTypeTable {
    table-layout: auto !important;
    width: 100% !important;
  }
  </style>