Skip to content

Commit

Permalink
Commas included in amount format !
Browse files Browse the repository at this point in the history
  • Loading branch information
shankygupta79 committed Jul 3, 2020
1 parent 48c6d82 commit 5898008
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 70 deletions.
22 changes: 11 additions & 11 deletions views/calculator.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,57 +117,57 @@
</td>
<td> <b>Net Pay: </b></td>
<td><b>{{symbol}}
{{parseInt(list[i-1]['employee_quick'].salary)+parseInt(list[i-1].bonus)+parseInt(list[i-1].extratimetotoal)-parseInt(list[i-1].deduction)-parseInt(list[i-1].advance)-parseInt(list[i-1].emi)-parseInt(list[i-1].holidays)-parseInt(list[i-1].transfer)}}</b>
{{(parseInt(list[i-1]['employee_quick'].salary)+parseInt(list[i-1].bonus)+parseInt(list[i-1].extratimetotoal)-parseInt(list[i-1].deduction)-parseInt(list[i-1].advance)-parseInt(list[i-1].emi)-parseInt(list[i-1].holidays)-parseInt(list[i-1].transfer)).toLocaleString('en-IN')}}</b>
</td>
</tr>
<tr>
<td> <b>Salary : </b></td>
<td class="green">{{symbol}}{{list[i-1]['employee_quick'].salary}}
<td class="green">{{symbol}}{{parseInt(list[i-1]['employee_quick'].salary).toLocaleString('en-IN')}}
</td>

<td> <b>Holidays : </b></td>
<td class="red">{{symbol}}{{list[i-1].holidays}}</td>
<td class="red">{{symbol}}{{parseInt(list[i-1].holidays).toLocaleString('en-IN')}}</td>

</tr>
<tr>
<td> <b>Extra Time : </b></td>
<td class="red">{{symbol}}{{list[i-1].extratimetotoal}}</td>
<td class="red">{{symbol}}{{parseInt(list[i-1].extratimetotoal).toLocaleString('en-IN')}}</td>

<td> <b>Advance : </b></td>
<td class="red" v-show="!edit">{{symbol}}{{list[i-1].advance}}</td>
<td v-show="edit"><input v-model="list[i-1].advance" type="number"> </td>
</tr>
<tr>
<td style="font-size: 1.2em;"> <b>Total Loan : </b></td>
<td style="font-size: 1.2em;">{{symbol}} {{ parseInt(list[i-1]['employee_quick'].totalloan)-parseInt(list[i-1].emi)+parseInt(list[i-1].emiold)}}
<td style="font-size: 1.2em;">{{symbol}} {{ ((parseInt(list[i-1]['employee_quick'].totalloan)-parseInt(list[i-1].emi)+parseInt(list[i-1].emiold)).toLocaleString('en-IN'))}}
</td>

<td class="loani wow"> <b>EMI : </b></td>
<td class="red loani wow" v-show="!edit">{{symbol}}{{list[i-1].emi}}</td>
<td class="red loani wow" v-show="!edit">{{symbol}}{{parseInt(list[i-1].emi).toLocaleString('en-IN')}}</td>
<td class="loani wow" v-show="edit"><input v-model="list[i-1].emi"
type="number"> </td>
</tr>
<tr>
<td class="bonus wow"> <b>Bonus : </b></td>
<td class="green bonus wow" v-show="!edit">{{symbol}}{{list[i-1].bonus}}</td>
<td class="green bonus wow" v-show="!edit">{{symbol}}{{parseInt(list[i-1].bonus).toLocaleString('en-IN')}}</td>
<td class="bonus wow" v-show="edit"><input v-model="list[i-1].bonus" type="number">
</td>

<td class="deduction wow"> <b>Deduction: </b></td>
<td class="red deduction wow" v-show="!edit">{{symbol}}{{list[i-1].deduction}}</td>
<td class="red deduction wow" v-show="!edit">{{symbol}}{{parseInt(list[i-1].deduction).toLocaleString('en-IN')}}</td>
<td class="deduction wow" v-show="edit"><input v-model="list[i-1].deduction"
type="number"> </td>
</tr>

<tr>
<td class="transfer wow"> <b>Balance : </b></td>
<td class="transfer wow">
<b>{{symbol}}{{parseInt(list[i-1]['employee_quick'].salary)+parseInt(list[i-1].bonus)+parseInt(list[i-1].extratimetotoal)-parseInt(list[i-1].deduction)-parseInt(list[i-1].advance)-parseInt(list[i-1].holidays)-parseInt(list[i-1].emi)}}</b>
<b>{{symbol}}{{(parseInt(list[i-1]['employee_quick'].salary)+parseInt(list[i-1].bonus)+parseInt(list[i-1].extratimetotoal)-parseInt(list[i-1].deduction)-parseInt(list[i-1].advance)-parseInt(list[i-1].holidays)-parseInt(list[i-1].emi)).toLocaleString('en-IN')}}</b>
</td>


<td class="transfer wow"> <b>Transfer : </b></td>
<td class="yellow transfer wow" v-show="!edit">{{symbol}}{{list[i-1].transfer}}
<td class="yellow transfer wow" v-show="!edit">{{symbol}}{{parseInt(list[i-1].transfer).toLocaleString('en-IN')}}
</td>
<td class="transfer wow" v-show="edit"><input v-model="list[i-1].transfer"
type="number"> </td>
Expand Down Expand Up @@ -210,7 +210,7 @@
data: {
myArray: [],
sortfield: 'Name',
symbol: 'rs',
symbol: '',
list: [],
sortarr: ['Name', 'Department', 'Designation', 'Date of Joining'],
sortarr2: ['name', 'des', 'dep', 'doj'],
Expand Down
14 changes: 7 additions & 7 deletions views/loan.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</div>
</div>
<div class="center" style="font-size: 1.5em;">
<b>TOTAL LOAN is </b>{{symbol}} {{given-reci}}
<b>TOTAL LOAN is </b>{{symbol}} {{parseInt(given-reci).toLocaleString('en-IN')}}
</div><br>
<table id='tblData'>
<tr>
Expand All @@ -97,10 +97,10 @@
<td>{{myArray[i-1].date}}</td>
<td>{{myArray[i-1].text}}</td>
<td>
<div v-show="myArray[i-1].type==0">{{symbol}} {{myArray[i-1].amount}}</div>
<div v-show="myArray[i-1].type==0">{{symbol}} {{parseInt(myArray[i-1].amount).toLocaleString('en-IN')}}</div>
</td>
<td>
<div v-show="myArray[i-1].type==1">{{symbol}} {{myArray[i-1].amount}}</div>
<div v-show="myArray[i-1].type==1">{{symbol}} {{parseInt(myArray[i-1].amount).toLocaleString('en-IN')}}</div>
</td>


Expand All @@ -113,10 +113,10 @@
<b>Total<b>
</td>
<td>
{{symbol}} {{given}}
{{symbol}} {{parseInt(given).toLocaleString('en-IN')}}
</td>
<td>
{{symbol}} {{reci}}
{{symbol}} {{parseInt(reci).toLocaleString('en-IN')}}
</td>
</tr>
</table><br>
Expand All @@ -142,7 +142,7 @@
</div>
<div v-if="listing==1"><br>
<div class="center" style="font-size: 1.5em;">
<b>TOTAL LOAN is </b>{{symbol}} {{totalloan}}
<b>TOTAL LOAN is </b>{{symbol}} {{parseInt(totalloan).toLocaleString('en-IN')}}
</div><br>
<div>
<div style="display: inline;">
Expand Down Expand Up @@ -189,7 +189,7 @@
{{loanarr[i-1].name}}
</td>
<td>
{{symbol}} {{loanarr[i-1].loan}}
{{symbol}} {{parseInt(loanarr[i-1].loan).toLocaleString('en-IN')}}
</td>
</tr>
</table>
Expand Down
77 changes: 48 additions & 29 deletions views/paylist.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<navbar-component></navbar-component>
<div id="navbar-top">
<navbar-top></navbar-top>
<div >

<div>
<div class="bord">


Expand Down Expand Up @@ -70,9 +70,16 @@
</div> <br>
<div v-if="success" class="success">
{{message_success}} !
</div> <br>
</div>
<img src="../images/loading" v-show="paylist" id="Loading" ref="Loading">
<div v-show="paylist" id="content2" ref="content2">
<div class="center" style="font-size: 1.2em;">
Total Balance Amount &nbsp;<b>{{symbol}} {{(totalb).toLocaleString('en-IN')}}</b>
</div>
<div class="center" style="font-size: 1.2em;">
Total Net Pay Amount &nbsp;<b>{{symbol}}{{(totaln).toLocaleString('en-IN')}}</b>
</div>

<div style="display: inline;">
Show <select @change="entryfun(entry)" v-model="entry">
<option value="10">10</option>
Expand Down Expand Up @@ -106,7 +113,7 @@
<tr v-for="i in myArray.length"
v-if="myArray[i-1]['employee_quick'].name.toLowerCase().includes(query.toLowerCase()) && i>=start && i<=end">
<td><b>{{myArray[i-1]['employee_quick'].name}}</b></td>
<td>{{symbol}} {{myArray[i-1].netpay}}</td>
<td>{{symbol}} {{(myArray[i-1].netpay).toLocaleString('en-IN')}}</td>
<td><button @click="download(myArray[i-1].emp_id)" class="btn btn-success"><i
class="fa fa-download" style="color:white" aria-hidden="true"></i>
Download</button>
Expand Down Expand Up @@ -164,7 +171,7 @@
myArray: [],
success: 0,
error: 0,
sortfield2:'',
sortfield2: '',
yearlist: [],
arr: ['01-', '02-', '03-', '04-', '05-', '06-', '07-', '08-', '09-', '10-', '11-', '12-'],
monthday: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
Expand All @@ -174,13 +181,15 @@
message_error: "Enter the full details",
message_success: "Paylists loaded successfully",
paylist: 0,
totalb: 0,
totaln: 0,
},
created: function () {
this.load();
},
methods: {
load: function () {


this.year();
}, entryfun(entry) {
Expand All @@ -191,16 +200,16 @@
this.pages.push(i)
}
}, sort(name, type) {
if(name=='Final Amount'){
this.sortfield=name
this.sortfield2='netpay'
}else{
this.sortfield='name'
this.sortfield2=this.sortfield
if (name == 'Final Amount') {
this.sortfield = name
this.sortfield2 = 'netpay'
} else {

this.sortfield = 'name'
this.sortfield2 = this.sortfield
}
this.sorticon=!this.sorticon
if (this.sortfield == 'name' || this.sortfield=='Final Amount') {
this.sorticon = !this.sorticon
if (this.sortfield == 'name' || this.sortfield == 'Final Amount') {

this.myArray.sort(this.compare)
}
Expand All @@ -209,16 +218,16 @@
}

}, compare(a, b) {
var nameA=''
var nameB=''
if(this.sortfield2=='netpay'){
var nameA = ''
var nameB = ''
if (this.sortfield2 == 'netpay') {
nameA = a[this.sortfield2]
nameB = b[this.sortfield2]
}else{
} else {
nameA = a['employee_quick'][this.sortfield2]
nameB = b['employee_quick'][this.sortfield2]
}

if (nameA < nameB) { return -1; }
if (nameA > nameB) { return 1; }
return 0;
Expand Down Expand Up @@ -251,7 +260,7 @@
loading.style.display = "none"
var content = app.$refs.content2
content.style.display = "block"
},loaderon() {
}, loaderon() {
var app = this;
var loading = app.$refs.Loading
loading.style.display = "block"
Expand All @@ -262,11 +271,18 @@
window.open(x, "_blank")

}, print(idx) {
var x = "https://payrollv2.herokuapp.com/payslips/printsingle?id=" + idx +"&month=" + this.arr[this.monthlist.indexOf(this.select_month)] + this.select_year+ "&action=print";
var x = "https://payrollv2.herokuapp.com/payslips/printsingle?id=" + idx + "&month=" + this.arr[this.monthlist.indexOf(this.select_month)] + this.select_year + "&action=print";
window.open(x, "_blank")
}, printall() {
var x = "https://payrollv2.herokuapp.com/payslips/printmultiple?&month=" + this.arr[this.monthlist.indexOf(this.select_month)] + this.select_year ;
var x = "https://payrollv2.herokuapp.com/payslips/printmultiple?&month=" + this.arr[this.monthlist.indexOf(this.select_month)] + this.select_year;
window.open(x, "_blank")
}, calc() {
for (var i = 0; i < log.myArray.length; i++) {

this.totalb = this.totalb + log.myArray[i].balance
this.totaln = this.totaln + log.myArray[i].netpay
}

}, year() {
var d = new Date();
var n = d.getFullYear() + 1;
Expand All @@ -278,26 +294,29 @@
this.select_month = this.monthlist[d.getMonth()];
this.select_year = n - 1;
}, submit() {

if (log.select_month == "" || log.select_year == "") {
log.error = 1
return
}
log.loaderon()
log.paylist = 1
log.totalb=0
log.totaln=0
axios.get('https://payrollv2.herokuapp.com/payslips/api/data?date=' + log.arr[log.monthlist.indexOf(log.select_month)] + log.select_year)
.then(function (Response1) {
if(Response1.length==0){
if (Response1.length == 0) {
console.log(Response1)
log.error=1
log.error = 1
log.loaderoff()
log.paylist = 0
log.message_error="NO RECORD FOUND"

log.message_error = "NO RECORD FOUND"
return

}
log.myArray = Response1
log.calc()
axios.get('https://payrollv2.herokuapp.com/settings/api/symbol')
.then(function (Response2) {
log.symbol = Response2
Expand All @@ -308,7 +327,7 @@
log.message_error = "Error connecting the database try again later !"
log.loaderoff()
})

log.total = log.myArray.length;
log.entryfun(log.entry);
log.loaderoff()
Expand Down
Loading

0 comments on commit 5898008

Please sign in to comment.