JezK
Edit File: page5.php
<?php include("header.php"); $_SESSION['bcFormPage'] = "page5.php"; //echo "<pre>";print_r($details);exit; if(!isset($_SESSION['bcFormUserID'])) { echo "<script>location.replace('page1.php');</script>"; } if(isset($_SESSION['saveSuccess'])) { echo "<script>alert('Data saved successfully.');</script>"; unset($_SESSION['saveSuccess']); } if(isset($_SESSION['auditUploadFailed'])) { echo "<script>alert('Error!!! Unable to upload audit files. Internal server error.');</script>"; unset($_SESSION['auditUploadFailed']); } if(isset($_SESSION['fileUploadFailed'])) { echo "<script>alert('Error!!! Unable to upload ceo profile files. Internal server error.');</script>"; unset($_SESSION['fileUploadFailed']); } if(isset($_SESSION['excelFileSaveFailed'])) { echo "<script>alert('Error!!! Unable to save excel file. Internal server error.');</script>"; unset($_SESSION['excelFileSaveFailed']); } if(isset($_SESSION['excelFileUploadFailed'])) { echo "<script>alert('Error!!! Unable to upload excel file. Internal server error.');</script>"; unset($_SESSION['excelFileUploadFailed']); } if(isset($_SESSION['bcIncomeSaveFailed'])) { echo "<script>alert('Error!!! Unable to update staff details. Internal server error.');</script>"; unset($_SESSION['bcIncomeSaveFailed']); } if(isset($_SESSION['bcIncomeUpdateFailed'])) { echo "<script>alert('Error!!! Unable to update income details. Internal server error.');</script>"; unset($_SESSION['bcIncomeUpdateFailed']); } if(isset($_SESSION['bcCEOProfileSaveFailed'])) { echo "<script>alert('Error!!! Unable to save ceo profile details. Internal server error.');</script>"; unset($_SESSION['bcCEOProfileSaveFailed']); } if(isset($_SESSION['bcCEOProfileUpdateFailed'])) { echo "<script>alert('Error!!! Unable to update ceo profile details. Internal server error.');</script>"; unset($_SESSION['bcCEOProfileUpdateFailed']); } if(isset($_SESSION['bcMFISaveFailed'])) { echo "<script>alert('Error!!! Unable to save mfi details. Internal server error.');</script>"; unset($_SESSION['bcMFISaveFailed']); } if(isset($_SESSION['bcMFIUpdateFailed'])) { echo "<script>alert('Error!!! Unable to update mfi details. Internal server error.');</script>"; unset($_SESSION['bcMFIUpdateFailed']); } if(isset($_SESSION['deleteSuccess'])) { echo "<script>alert('Data deleted succesfully.');</script>"; unset($_SESSION['deleteSuccess']); } if(isset($_SESSION['deleteFailed'])) { echo "<script>alert('Error!!! Unable to delete registration details. Internal server error.');</script>"; unset($_SESSION['deleteFailed']); } ?> <div class="container main"> <div class="row"> <form action = "app/page5App.php" enctype="multipart/form-data" class="form-horizontal" method="post" onsubmit="return validatePage5()"> <div class="col-md-12 col-md-offset-0 formContainer"> <section> <div class=""> <div class="col-md-12 removePadding"> <h3 class="subHead col-md-11 removePadding">Income, Expenditure For Past 3 Years <span class="star">*</span></h3> <!--<input type="button" class="col-md-1 btn btn-default addBtn2 pull-right" value="Add New" >--> </div> <div class="col-md-12 removePadding table-responsive"> <table class="table table-bordered cs-table"> <thead> <tr> <th> Year</th> <th>Total Income <small>(Rs)</small></th> <th>Total Expenditure <small>(Rs)</small></th> <th>Profit Or Loss <small>(Rs)</small></th> <th>Upload audit report<br> <small> (upload pdf/image only)</small> </th> <!--<th>Action</th>--> </tr> </thead> <tbody class="input_fields_wrap2"> <?php echo $incomeDetails; ?> </tbody> </table> </div> </div> </section> <section> <div class="col-md-12 removePadding"> <h3 class="subHead removePadding col-md-11">Particulars of SHGs formed and credit linked <span class="star">*</span></h3> <input type="button" class="col-md-1 btn btn-default addBtn3 pull-right" value="Add New" > </div> <div class="table-responsive col-md-12 removePadding"> <table class="table table-bordered cs-table table-responsive"> <thead> <tr> <th>Year</th> <th>No. of SHGs formed</th> <th>No. of SHG’s adopted</th> <th>No. of SHGs savings Linked</th> <th>No. of SHGs credit Linked</th> <th>Total loan disbursed <small>(Rs)</small></th> <!--<th>Upload<br> <small> (upload pdf only)</small></th>--> <th>Action</th> </tr> </thead> <tbody class="input_fields_wrap3"> <?php echo $ceoProfileDetails; ?> </tbody> </table> </div> <div class="form-group col-md-12" style="padding-top:10px;"> <label class="col-md-0">Loyalty List<small></small>:</label> <input type="hidden" value="<?php echo $excelFileStatus; ?>" id="excelUploadStatus"> <input type="file" value="" id="excelFile" name="excelFile" class="browse-o" onchange="ValidateExcelFileUpload()"> <div style="min-width:150px;display:inline-block;"> <button type="button" class="browse-d">Browse</button> <div id="excelFileStatus" class="divSuccess"><?php echo $excelFileUploadStatus; ?></div> </div> <a href="download.php?type=1&file=loyaltiList.xlsx" class="btn btn-default" style="margin-left:20px;">Download Sample Excel Sheet</a> </div> </section> <div style="clear:both;"></div> <section> <h3 class="col-md-11 removePadding">If already acting as MFI date of commencement of MFI activity <span class="star">*</span> <input type="radio" name="isMFI" value="1" id="mfiYes" <?php echo $isMFI1; ?> onclick="displayMFI(1)"> <label for="mfiYes1" style="color:black;font-weight:normal;cursor:pointer;">Yes</label> <input type="radio" name="isMFI" value="0" id="mfiNo" <?php echo $isMFI2; ?> onclick="displayMFI(0)"> <label for="mfiNo1" style="color:black;font-weight:normal;cursor:pointer;">No</label> </h3> <div id="mfiActivity"> <!--<input type="button" class="btn btn-default addBtn4 pull-right" value="Add New" >--> <div style="clear:both;"></div> <div class="input_fields_wrapMFI"></div> <!--MFI details--> <div class="input_fields_wrap4"> <div class="form-group"> <label class="col-md-3" for="details" >Date of commencement of operation :</label> <input type="hidden" name="mfiID" id="mfiID" value=""> <div class="input-group date col-md-3" > <input type="text" class="form-control" name="mfiDate" id="mfiDate" placeholder="Date of commencement of operation" value="<?php echo $mfiDate; ?>"> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="form-group"> <label class="col-md-3" for="details" >H.O Address</label> <div class=""> <textarea name="mfiAddress" id="mfiAddress" class="col-md-3" rows="3"><?php echo $mfiAddress; ?></textarea> </div> </div> <!--<div class="form-group"> <label class="col-md-3" for="activeGroups" >No. of active groups</label> <div class=""> <input type="text" name="mfiTotalActiveGroups" id="mfiTotalActiveGroups" placeholder="" class="col-md-4" onkeypress="return number2(event)" value="<?php echo $mfiTotalActiveGroups; ?>"> </div> </div>--> <div class="form-group"> <label class="col-md-3" for="totalLoanDisbursed" >Total loan amount disbursed (Rs in Lakhs)</label> <div class=""> <input type="text" name="mfiTotalLoan" id="mfiTotalLoan" placeholder="" class="col-md-4" onkeypress="return number2(event)" value="<?php echo $mfiTotalLoan; ?>"> </div> </div> <div class="form-group"> <label class="col-md-3" for="outStanding" >Outstanding amount (Rs in Lakhs) </label> <div class=""> <input type="text" name="mfiOutstanding" id="mfiOutstanding" placeholder="" value="<?php echo $mfiOutstanding; ?>" class="col-md-4" onkeypress="return number2(event)"> </div> </div> <div class="form-group"> <label class="col-md-3" for="outstandingGroups" >Outstanding no of groups </label> <div class=""> <input type="text" name="mfiOutstandingGroups" id="mfiOutstandingGroups" placeholder="" class="col-md-4" value="<?php echo $mfiOutstandingGroups; ?>"> </div> </div> <h3 class="col-md-12 removePadding" for="MFIRating" >Credit Rating of MFI, If any</h3> <div class="table-responsive col-md-12 removePadding"> <table class="table table-bordered cs-table table-responsive"> <thead> <tr> <th>Name of Credit Rating Agency groups</th> <th>Rating Awarded </th> </tr> </thead> <tbody class="input_fields_wrap33"> <tr> <td> <input type="text" name="mfiCreditRatingName" id="mfiCreditRatingName" placeholder="" value="<?php echo $mfiCreditRatingName; ?>"> </td> <td> <input type="text" name="mfiRatingAwarded" id="mfiRatingAwarded" placeholder="" value="<?php echo $mfiRatingAwarded; ?>"> </td> </tr> </tbody> </table> </div> <div class="form-group"> <label class="col-md-3 subHead" for="district">Portfolio at Risk:</label> </div> <div class="table-responsive col-md-12 removePadding"> <table class="table table-bordered cs-table table-responsive"> <thead> <tr> <th>PAR(30-60)</th> <th>PAR(60-90)</th> <th>PAR(>90)</th> </tr> </thead> <tbody class=""> <tr> <td> <div style="padding-bottom:10px;"> <label class="col-xs-5">No. Of groups : </label> <input type="text" name="mfiGroups30" id="mfiGroups30" placeholder=" " value="<?php echo $mfiGroups30; ?>" onkeypress="return number2(event)"> </div> <div> <label class="col-xs-5">Amount (₹): </label> <input type="text" name="mfiNPAAmout30" id="mfiNPAAmout30" placeholder=" " value="<?php echo $mfiNPAAmout30; ?>" onkeypress="return number2(event)"> </div> </td> <td> <div style="padding-bottom:10px;"> <label class="col-xs-5">No. Of groups : </label> <input type="text" name="mfiGroups60" id="mfiGroups60" placeholder="" value="<?php echo $mfiGroups60; ?>" onkeypress="return number2(event)"> </div> <div> <label class="col-xs-5">Amount (₹) : </label> <input type="text" name="mfiNPAAmout60" id="mfiNPAAmout60" placeholder="" value="<?php echo $mfiNPAAmout60; ?>" onkeypress="return number2(event)"> </div> </td> <td> <div style="padding-bottom:10px;"> <label class="col-xs-5">No. Of groups : </label> <input type="text" name="mfiGroups90" id="mfiGroups90" placeholder="" value="<?php echo $mfiGroups90; ?>" onkeypress="return number2(event)"> </div> <div> <label class="col-xs-5">Amount (₹) : </label> <input type="text" name="mfiNPAAmout90" id="mfiNPAAmout90" placeholder="" value="<?php echo $mfiNPAAmout90; ?>" onkeypress="return number2(event)"> </div> </td> </tr> </tbody> </table> </div> <div class="form-group"> <label class="col-md-3" for="repaymentRate" >Repayment % against demand </label> <div class=""> <input type="text" name="mfiRepaymentRate" id="mfiRepaymentRate" placeholder="" class="col-md-4" onkeypress="return number2(event)" value="<?php echo $mfiRepaymentRate; ?>"> </div> </div> <div class="form-group"> <label class="col-md-3" for="totalGroups" >No of groups</label> <div class=""> <input type="text" name="mfiTotalGroups" id="mfiTotalGroups" placeholder=" " onkeypress="return number(event)" value="<?php echo $mfiTotalGroups; ?>"> </div> </div> <h3>Area of operations</h3> <div class="addressBlock"> <div class="col-md-12"> <input type="button" class="btn btn-default addAddressBtn pull-right" value="Add New" style="margin-bottom:0px !important;"> <?php echo $bcMFIStates; ?> </div> </div> </div> <!--MFI details--> </div> </section> <div class="text-center col-md-12"> <a href="page4.php"><input type="button" value="Back" class="btn btn-cs"></a> <input type="submit" value="Next" class="btn btn-cs"> </div> <div class="col-md-12 text-right">5 of 6</div> </div><!--end formContainer--> </form> </div> </div> </div> <?php include"footer.php"?> <script type='text/javascript'> pdfFlag = 0; excelFlag = 0; $(document).ready(function() { var mfi1 = '<?php echo $isMFI1; ?>'; if(mfi1 == '') { document.getElementById('mfiActivity').style.display = 'none'; } $(".browse-d").click(function() { $(this).parents(".form-group").find('.browse-o').click(); //$(".browse-o").closest(".form-group"); }); var wrapper2 = $(".input_fields_wrap2"); var add_button2 = $(".addBtn2"); $('.input-group.date').datepicker( { calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); var x1 = '<?php echo $incomeDetailsCount; ?>'; $(add_button2).click(function(e) { /*financialYear = document.getElementById('financialYear'+x1); totalIncome = document.getElementById('totalIncome'+x1); totalExpenditure = document.getElementById('totalExpenditure'+x1); excess = document.getElementById('excess'+x1); auditStatus = document.getElementById('auditStatus'+x1);*/ financialYear = document.getElementById('financialYear1'); totalIncome = document.getElementById('totalIncome1'); totalExpenditure = document.getElementById('totalExpenditure1'); excess = document.getElementById('excess1'); auditStatus = document.getElementById('auditStatus1'); if(financialYear.value.trim() != "" && totalIncome.value.trim() != "" && totalExpenditure.value.trim() != "" && excess.value.trim() != "") { if(auditStatus.value == 1) { e.preventDefault(); // if(x < max_fields){ //max input box allowed x1++; //text box increment $(wrapper2).append('<tr><td><input type="hidden" name="incomeID[]" id="incomeID'+x1+'" value=""><input type="text" name="financialYear[]" id="financialYear'+x1+'" maxlength="4" placeholder="Year" onkeypress="return number(event)"></td><td><input type="text" name="totalIncome[]" id="totalIncome'+x1+'" placeholder="Total Income" onkeypress="return number2(event)"></td><td><input type="text" name="totalExpenditure[]" id="totalExpenditure'+x1+'" placeholder="Total Expenditure" onkeypress="return number2(event)"></td><td><input type="text" name="excess[]" name="excess'+x1+'" placeholder="Excess of income over expenditure" onkeypress="return number2(event)"></td><td><div class="form-group" style="margin:0px;"><input type="hidden" name="auditFile[]" id="auditFile'+x1+'" value=""><input type="hidden" value="0" id="auditStatus'+x1+'"><input type="file" name="audit[]" id="audit'+x1+'" value="" class="browse-o" onchange=\'ValidateFileUpload("audit'+x1+'","auditStatus'+x1+'",'+x1+')\'><button type="button" class="browse-d" id="browse-dd'+x1+'">Browse</button><div id="auditFileUploadStatus'+x1+'" class="divSuccess"></div></div></td><td><a class="action2"><i class="fa fa-trash remove_field2" aria-hidden="true" ></i></a></td></tr>'); //add input box //} } else { alert("Please upload a valid file."); } } else { alert("Please fill all fields first."); } var str='<script>$("#browse-dd'+x1+'").click(function(){$(this).closest(".form-group").find("#audit'+x1+'").click();});'; str+="<"; str+="/script>"; $("body").append(str); }); $(wrapper2).on("click",".remove_field2", function(e){ //user click on remove text e.preventDefault(); $(this).closest('tr').remove(); }); //var max_fields = ; //maximum input boxes allowed var wrapper3 = $(".input_fields_wrap3"); //Fields wrapper var add_button3 = $(".addBtn3"); //Add button ID $('.input-group.date').datepicker( { calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); var x2 = '<?php echo $ceoProfileCount; ?>'; //initlal text box count $(add_button3).click(function(e) { //on add input button click e.preventDefault(); $('.input-group.date').datepicker( { calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); /* ceoYear = document.getElementById('ceoYear'+x2); totalSHGFormed = document.getElementById('totalSHGFormed'+x2); totalSHGAdopted = document.getElementById('totalSHGAdopted'+x2); totalSHGSavings = document.getElementById('totalSHGSavings'+x2); totalSHGCredit = document.getElementById('totalSHGCredit'+x2); totalLoan = document.getElementById('totalLoan'+x2);*/ //ceoYear = document.getElementById('ceoYear1'); totalLength = document.getElementsByName('totalSHGFormed[]').length; for(i=0;i<totalLength;i++) { ceoYear = document.getElementsByName('ceoYear[]'); totalSHGFormed = document.getElementsByName('totalSHGFormed[]'); totalSHGAdopted = document.getElementsByName('totalSHGAdopted[]'); totalSHGSavings = document.getElementsByName('totalSHGSavings[]'); totalSHGCredit = document.getElementsByName('totalSHGCredit[]'); totalLoan = document.getElementsByName('totalLoan[]'); //managementFileStatus =managementFileStatus[i] ; if(ceoYear[i].value.trim() != "" && totalSHGFormed[i].value.trim() != "" && totalSHGAdopted[i].value.trim() != "" && totalSHGSavings[i].value.trim() != "" && totalSHGCredit[i].value.trim() != "" && totalLoan[i].value.trim() != "") { flag1 = 1; } else { flag1 = 0; break; } } if(flag1 == 1) { /*if(ceoFileStatus == 1) {*/ x2++; //text box increment $(wrapper3).append('<tr><td><input type="hidden" name="ceoProfileID[]" id="ceoProfileID'+x2+'" value=""><input type="text" name="ceoYear[]" id="ceoYear'+x2+'" minlength="" placeholder="YYYY"></td><td><input type="text" name="totalSHGFormed[]" id="totalSHGFormed'+x2+'" placeholder="No. of SHGs formed" onkeypress="return number(event)"></td><td><input type="text" name="totalSHGAdopted[]" id="totalSHGAdopted'+x2+'" placeholder="No. of SHG’s adopted " onkeypress="return number(event)"></td><td><input type="text" name="totalSHGSavings[]" id="totalSHGSavings'+x2+'" placeholder="No. of SHGs savings Linked" onkeypress="return number(event)"></td><td class=""><input type="text" name="totalSHGCredit[]" id="totalSHGCredit'+x2+'" placeholder="No. of SHGs credit Linked" onkeypress="return number2(event)"></td><td class=""><input type="text" name="totalLoan[]" id="totalLoan'+x2+'" placeholder="Total loan disbursed" onkeypress="return number2(event)"></td><td><a class="action2"><i class="fa fa-trash remove_field3" aria-hidden="true" ></i></a></td></tr>'); //add input box /*} else { alert("Please upload a valid file."); }*/ } else { alert("Please fill all fields first."); } var str='<script>$("#browse-df'+x2+'").click(function(){$(this).closest(".form-group").find("#file'+x2+'").click();});'; str+="<"; str+="/script>"; $("body").append(str); //} $('.input-group.date').datepicker({ calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); }); $(wrapper3).on("click",".remove_field3", function(e){ //user click on remove text e.preventDefault(); $(this).closest('tr').remove(); }); //var max_fields = ; //maximum input boxes allowed var wrapper4 = $(".input_fields_wrapMFI"); //Fields wrapper var add_button4 = $(".addBtn4"); //Add button ID $('.input-group.date').datepicker({ calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); var x = '<?php echo $bcMFIDetailsCount; ?>'; //initlal text box count $(add_button4).click(function(e) { /*date = document.getElementById('date'+x); address = document.getElementById('address'+x); state = document.getElementById('state'+x); district = document.getElementById('district'+x); taluk = document.getElementById('taluk'+x); totalActiveGroups = document.getElementById('totalActiveGroups'+x); mfiTotalLoan = document.getElementById('mfiTotalLoan'+x); outstanding = document.getElementById('outstanding'+x); outstandingGroups = document.getElementById('outstandingGroups'+x); creditRating = document.getElementById('creditRating'+x); creditRatingName = document.getElementById('creditRatingName'+x); ratingAwarded = document.getElementById('ratingAwarded'+x); mfiTotalExpenditure = document.getElementById('mfiTotalExpenditure'+x); //portfolio = document.getElementById('portfolio'+x); npaAmout30 = document.getElementById('npaAmout30'+x); npaAmout60 = document.getElementById('npaAmout60'+x); npaAmout90 = document.getElementById('npaAmout90'+x); repaymentRate = document.getElementById('repaymentRate'+x); totalGroups = document.getElementById('totalGroups'+x);*/ date = document.getElementById('date'); address = document.getElementById('address'); state = document.getElementById('state'); district = document.getElementById('district'); taluk = document.getElementById('taluk'); totalActiveGroups = document.getElementById('totalActiveGroups'); mfiTotalLoan = document.getElementById('mfiTotalLoan'); outstanding = document.getElementById('outstanding'); outstandingGroups = document.getElementById('outstandingGroups'); creditRating = document.getElementById('creditRating'); creditRatingName = document.getElementById('creditRatingName'); ratingAwarded = document.getElementById('ratingAwarded'); mfiTotalExpenditure = document.getElementById('mfiTotalExpenditure'); //portfolio = document.getElementById('portfolio'+x); npaAmout30 = document.getElementById('npaAmout30'); npaAmout60 = document.getElementById('npaAmout60'); npaAmout90 = document.getElementById('npaAmout90'); repaymentRate = document.getElementById('repaymentRate'); totalGroups = document.getElementById('totalGroups'); if(date.value.trim() != "" && address.value.trim() != "" && totalActiveGroups.value.trim() != "" && mfiTotalLoan.value.trim() != "" && outstanding.value.trim() != "" && creditRatingName.value.trim() != "" && ratingAwarded.value.trim() != "" && repaymentRate.value.trim() != "" && totalGroups.value.trim() != "" && state.value != 0 && district.value != 0 && taluk.value != "" && outstandingGroups.value != "" && npaAmout30.value != "" && npaAmout60.value != "" && npaAmout90.value != "") { //on add input button click e.preventDefault(); // if(x < max_fields){ //max input box allowed x++; //text box increment $(wrapper4).append('<div class="tr"><a class="action2"><i class="fa fa-trash pull-right remove_field4" aria-hidden="true" style="float:right;"></i></a><div class="form-group"><label class="col-md-3" for="details" >Date of commencement of operation :</label><input type="hidden" name="mfiID[]" id="mfiID'+x+'" value=""><div class="input-group date col-md-3" ><input type="text" class="form-control" name="date[]" id="date'+x+'" placeholder="Date of commencement of operation" readonly /><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span></div> </div><div class="form-group"><label class="col-md-3" for="details" >H.O Address</label><div class=""><textarea name="address[]" id="address'+x+'" class="col-md-3" rows="3"></textarea></div></div><div class="form-group"><label class="col-md-3" for="state" >State</label><div class=""><select name="state[]" id="state'+x+'" class="col-md-4" onchange="getDistricts(this.value,'+x+')"><option value="0">Select State</option><?php echo $newStates; ?></select></div></div><div class="form-group"><label class="col-md-3" for="district">District</label><div class=""><select name="district[]" id="district'+x+'" class="col-md-4"><option value="0">Select District</option></select></div></div> \ <div class="form-group"> \ <label class="col-md-3" for="taluk" >Taluk</label> \ <div class=""> \ <input type="text" name="taluk[]" id="taluk'+x+'" value="" placeholder="Taluk" class="col-md-4" > \ </div> \ </div> \ <div class="form-group"><label class="col-md-3" for="activeGroups" >No. of active groups</label><div class=""><input type="text" name="totalActiveGroups[]" id="totalActiveGroups'+x+'" placeholder="" class="col-md-4" onkeypress="return number(event)"></div></div><div class="form-group"><label class="col-md-3" for="totalLoanDisbursed" >Total loan amount disbursed (Rs in Lakhs)</label><div class=""><input type="text" name="mfiTotalLoan[]" id="mfiTotalLoan'+x+'" placeholder="" class="col-md-4" onkeypress="return number2(event)"></div></div><div class="form-group"><label class="col-md-3" for="outStanding" >Outstanding amount (Rs in Lakhs)</label><div class=""><input type="text" name="outstanding[]" id="outstanding'+x+'" placeholder="" class="col-md-4"></div></div> \ <div class="form-group"> \ <label class="col-md-3" for="outstandingGroups" >Outstanding no of groups </label> \ <div class=""> \ <input type="text" name="outstandingGroups[]" id="outstandingGroups'+x+'" value="" placeholder="" class="col-md-4" > \ </div> \ </div>\ <h3 class="col-md-12 removePadding" for="MFIRating" >Credit Rating of MFI, If any</h3>\ <div class="table-responsive col-md-12 removePadding"><table class="table table-bordered cs-table table-responsive"><thead><tr><th>Name of Credit Rating Agency groups</th><th>Rating Awarded </th></tr></thead><tbody class="input_fields_wrap33"><tr><td><input type="text" name="creditRatingName[]" id="creditRatingName'+x+'" placeholder=""></td><td><input type="text" name="ratingAwarded[]" id="ratingAwarded'+x+'" placeholder=""></td></tr></tbody></table></div><div class="form-group"><label class="col-md-3" for="district">Portfolio at Risk : </label></div>\ <div class="table-responsive col-md-12 removePadding"> \ <table class="table table-bordered cs-table table-responsive"><thead>\ <tr><th>PAR(30-60)</th><th>PAR(60-90)</th><th>PAR(>90)</th></tr></thead>\ <tbody class="input_fields_wrap34"> \ <tr><td><input type="text" name="npaAmout30[]" id="npaAmout30'+x+'" placeholder=" " ></td> \ <td><input type="text" name="npaAmout60[]" id="npaAmout60'+x+'" placeholder="" ></td> \ <td><input type="text" name="npaAmout90[]" id="npaAmout90'+x+'" placeholder="" ></td> \ </tr></tbody></table></div> \ <div class="form-group"><label class="col-md-3" for="repaymentRate">Repayment % against demand</label><div class=""><input type="text" name="repaymentRate[]" id="repaymentRate'+x+'" placeholder="" class="col-md-4" onkeypress="return number2(event)"></div></div> \ <div class="form-group"> \ <label class="col-md-3" for="totalGroups" >No of groups</label> \ <div class=""> \ <input type="text" name="totalGroups[]" id="totalGroups'+x+'" placeholder="" class="col-md-4" onkeypress="return number(event)" > \ </div> \ </div> \ </div></div>'); //add input box //} /*<div class="table-responsive col-md-12 removePadding"><table class="table table-bordered cs-table table-responsive"><thead><tr><th>No of groups</th><th>Amount of PAR (Rs. lakh)</th></tr></thead><tbody class="input_fields_wrap34"><tr><td><input type="text" name="totalGroups[]" id="totalGroups'+x+'" placeholder=" " onkeypress="return number(event)"></td><td><input type="text" name="amount[]" id="amount'+x+'" placeholder="" onkeypress="return number2(event)"></td></tr></tbody></table></div>*/ } else { alert("Please fill all fields first."); } $('.input-group.date').datepicker({ calendarWeeks: true, todayHighlight: true, autoclose: true , format:"dd/mm/yyyy" }); }); $(wrapper4).on("click",".remove_field4", function(e){ //user click on remove text e.preventDefault(); $(this).closest('.tr').remove(); }); //Repeat address in MFI var addressBlock = $(".addressBlock"); //Fields wrapper var addAddressBtn = $(".addAddressBtn"); //Add button ID var z = '<?php echo $bcMFIStatesCount; ?>'; //alert(nameLength); $(addAddressBtn).click(function(e) { //alert(mfiDistrict[0].value.trim()); mfiTalukLength = document.getElementsByName('mfiTaluk[]').length; for(i=0;i<mfiTalukLength;i++) { mfiState = document.getElementsByName('mfiState[]'); mfiDistrict = document.getElementsByName('mfiDistrict[]'); mfiTaluk = document.getElementsByName('mfiTaluk[]'); if(mfiState[i].value.trim() != 0 && mfiDistrict[i].value.trim() !=0 && mfiTaluk[i].value.trim() != "") { flag = 1; } else { flag = 0; break; } } if(flag == 1) { //alert(z); e.preventDefault(); // if(x < max_fields){ //max input box allowed z++; //text box increment $(addressBlock).append('<div class="col-md-12 tr">\ <div class="form-group">\ <label class="col-md-3" for="state" >State</label>\ <div class="">\ <input type="hidden" name="mfiStateID[]" value="">\ <select name="mfiState[]" id="mfiState'+z+'" class="col-md-4" onchange="getDistricts(this.value,'+z+')"> \ <option value="0">Select State</option>\ <?php echo $mfiStatesNew; ?>\ </select>\ </div>\ <a class="action2"><i class="fa fa-trash removeAddressBlock" aria-hidden="true" ></i></a>\ </div>\ <div class="form-group">\ <label class="col-md-3" for="district">District</label>\ <div class="">\ <select name="mfiDistrict[]" id="mfiDistrict'+z+'" class="col-md-4">\ <option value="0">Select District</option>\ </select>\ </div>\ </div>\ <div class="form-group">\ <label class="col-md-3" for="taluk" >Talukas</label>\ <div class="">\ <input type="text" name="mfiTaluk[]" id="mfiTaluk'+z+'" value="" placeholder="Taluk" class="col-md-4" >\ </div>\ </div>\ <hr></div>'); //add input box // } else { alert("Please fill all fields first."); } }); $(addressBlock).on("click",".removeAddressBlock", function(e){ //user click on remove text e.preventDefault(); $(this).closest('.tr').remove(); }); }); function ValidateExcelFileUpload() { excelFlag = 0; var fuData = document.getElementById('excelFile'); var fileStatus = document.getElementById('excelUploadStatus'); var FileUploadPath = fuData.value; var excelFileStatus = document.getElementById('excelFileStatus'); //To check if user upload any file if (FileUploadPath == '') { alert("Please upload a excel file."); fileStatus.value = 0; excelFileStatus.innerHTML = '<span class="fail"></span>'; excelFlag = 0; } else { var Extension = FileUploadPath.substring( FileUploadPath.lastIndexOf('.') + 1).toLowerCase(); //The file uploaded is an pdf if (Extension == "xls" || Extension == "xlsx") { var size=1048576; var file_size=fuData.files[0].size; if(file_size>=size) { alert('File too large'); fileStatus.value = 0; excelFlag = 0; } else { excelFlag = 1; excelFileStatus.innerHTML = '<span class="success"></span>'; fileStatus.value = 1; } } //The file upload is NOT an pdf else { alert("Please upload a excel file."); excelFileStatus.innerHTML = '<span class="fail"></span>'; fileStatus.value = 0; excelFlag = 0; } } } function ValidateFileUpload(fileID,fileStatusID,ID) { pdfFlag = 0; var fuData = document.getElementById(fileID); var fileStatus = document.getElementById(fileStatusID); var FileUploadPath = fuData.value; var auditFileUploadStatus = document.getElementById('auditFileUploadStatus'+ID); //var ceoFileUploadStatus= document.getElementById('ceoFileUploadStatus'+ID); //To check if user upload any file if (FileUploadPath == '') { alert("Please upload a pdf/image file."); fileStatus.value = 0; auditFileUploadStatus.innerHTML = '<span class="fail"></span>'; //ceoFileUploadStatus.innerHTML = '<span class="fail"></span>'; pdfFlag = 0; } else { var Extension = FileUploadPath.substring( FileUploadPath.lastIndexOf('.') + 1).toLowerCase(); //The file uploaded is an pdf if (Extension == "pdf" || Extension == "jpeg" || Extension == "jpg" || Extension == "png" ) { var size=5242880; var file_size=fuData.files[0].size; if(file_size>=size) { alert('File too large'); fileStatus.value = 0; pdfFlag = 0; } else { pdfFlag = 1; auditFileUploadStatus.innerHTML = '<span class="success"></span>'; //ceoFileUploadStatus.innerHTML = '<span class="success"></span>'; fileStatus.value = 1; } } //The file upload is NOT an pdf else { alert("Please upload a pdf/image file."); auditFileUploadStatus.innerHTML = '<span class="fail"></span>'; //ceoFileUploadStatus.innerHTML = '<span class="fail"></span>'; fileStatus.value = 0; } } } function ValidateFileUpload2(fileID,fileStatusID) { pdfFlag = 0; var fuData = document.getElementById(fileID); var fileStatus = document.getElementById(fileStatusID); var FileUploadPath = fuData.value; var auditFileUploadStatus = document.getElementById('auditFileUploadStatus'+ID); var ceoFileUploadStatus= document.getElementById('ceoFileUploadStatus'+ID); //To check if user upload any file if (FileUploadPath == '') { alert("Please upload a pdf/image file."); fileStatus.value = 0; auditFileUploadStatus.innerHTML = '<span class="fail"></span>'; ceoFileUploadStatus.innerHTML = '<span class="fail"></span>'; pdfFlag = 0; } else { var Extension = FileUploadPath.substring( FileUploadPath.lastIndexOf('.') + 1).toLowerCase(); //The file uploaded is an pdf if (Extension == "pdf" || Extension == "jpeg" || Extension == "jpg" || Extension == "png" ) { var size=1048576; var file_size=fuData.files[0].size; if(file_size>=size) { alert('File too large'); fileStatus.value = 0; pdfFlag = 0; } else { pdfFlag = 1; auditFileUploadStatus.innerHTML = '<span class="success"></span>'; ceoFileUploadStatus.innerHTML = '<span class="success"></span>'; fileStatus.value = 1; } } //The file upload is NOT an pdf else { alert("Please upload a pdf/image file."); auditFileUploadStatus.innerHTML = '<span class="fail"></span>'; ceoFileUploadStatus.innerHTML = '<span class="fail"></span>'; fileStatus.value = 0; } } } function number(e) { //if(e.keyCode == 13 || (e.keyCode >= 48 && e.keyCode <= 57)) var key = e.keyCode || e.charCode; if(key == 13 || key == 43 || (key >= 48 && key <= 57) || key == 8 || key == 46) { return true; } else { return false; } } function number2(e) { //if(e.keyCode == 13 || e.keyCode == 46 || (e.keyCode >= 48 && e.keyCode <= 57)) var key = e.keyCode || e.charCode; if(key == 13 || key == 43 || (key >= 48 && key <= 57) || key == 8 || key == 46) { return true; } else { return false; } } function getDistricts(stateID,i) { if(stateID == 0) { document.getElementById('mfiDistrict'+i).innerHTML = ""; document.getElementById('mfiDistrict'+i).innerHTML = '<option value="0">Select District</option>'; } else { $.post("app/ajax.php",{type:1,stateID:stateID},function(data) { document.getElementById('mfiDistrict'+i).innerHTML = '<option value="0">Select District</option>'+data; }); } } function displayMFI(i) { if(i==0) { document.getElementById('mfiActivity').style.display = 'none'; /*document.getElementById('date'+x).value = ""; document.getElementById('address'+x).value = ""; document.getElementById('state'+x).value = 0; document.getElementById('district'+x).value = 0; document.getElementById('totalActiveGroups'+x).value = ""; document.getElementById('mfiTotalLoan'+x).value = ""; document.getElementById('outstanding'+x).value = ""; document.getElementById('creditRating'+x).value = ""; document.getElementById('creditRatingName'+x).value = ""; document.getElementById('ratingAwarded'+x).value = ""; document.getElementById('mfiTotalExpenditure'+x).value = ""; document.getElementById('portfolio'+x).value = 0; document.getElementById('repaymentRate'+x).value = ""; document.getElementById('totalGroups'+x).value = ""; document.getElementById('amount'+x).value = "";*/ } else { document.getElementById('mfiActivity').style.display = 'block'; } } function validatePage5() { financialYear1 = document.getElementById('financialYear1'); totalIncome1 = document.getElementById('totalIncome1'); totalExpenditure1 = document.getElementById('totalExpenditure1'); excess1 = document.getElementById('excess1'); auditStatus1 = document.getElementById('auditStatus1'); financialYear2 = document.getElementById('financialYear2'); totalIncome2 = document.getElementById('totalIncome2'); totalExpenditure2 = document.getElementById('totalExpenditure2'); excess2 = document.getElementById('excess2'); auditStatus2 = document.getElementById('auditStatus2'); financialYear3 = document.getElementById('financialYear3'); totalIncome3 = document.getElementById('totalIncome3'); totalExpenditure3 = document.getElementById('totalExpenditure3'); excess3 = document.getElementById('excess3'); auditStatus3 = document.getElementById('auditStatus3'); /*ceoYear = document.getElementById('ceoYear1'); totalSHGFormed = document.getElementById('totalSHGFormed1'); totalSHGAdopted = document.getElementById('totalSHGAdopted1'); totalSHGSavings = document.getElementById('totalSHGSavings1'); totalSHGCredit = document.getElementById('totalSHGCredit1'); totalLoan = document.getElementById('totalLoan1');*/ //ceoFileStatus = document.getElementById('ceoFileStatus1'); excelUploadStatus = document.getElementById('excelUploadStatus'); excelFile = document.getElementById('excelFile'); if(financialYear1.value.trim() == "") { alert("Please enter year."); financialYear1.value = ""; financialYear1.focus(); return false; } if(totalIncome1.value.trim() == "") { alert("Please enter total income."); totalIncome1.value = ""; totalIncome1.focus(); return false; } if(totalExpenditure1.value.trim() == "") { alert("Please enter total expenditure."); totalExpenditure1.value = ""; totalExpenditure1.focus(); return false; } if(excess1.value.trim() == "") { alert("Please enter excess."); excess1.value = ""; excess1.focus(); return false; } if(auditStatus1.value == 0) { alert("Please upload a valid audit file."); return false; } if(financialYear2.value.trim() == "") { alert("Please enter year."); financialYear2.value = ""; financialYear2.focus(); return false; } if(totalIncome2.value.trim() == "") { alert("Please enter total income."); totalIncome2.value = ""; totalIncome2.focus(); return false; } if(totalExpenditure2.value.trim() == "") { alert("Please enter total expenditure."); totalExpenditure2.value = ""; totalExpenditure2.focus(); return false; } if(excess2.value.trim() == "") { alert("Please enter excess."); excess2.value = ""; excess2.focus(); return false; } if(auditStatus2.value == 0) { alert("Please upload a valid audit file."); return false; } if(financialYear3.value.trim() == "") { alert("Please enter year."); financialYear3.value = ""; financialYear3.focus(); return false; } if(totalIncome3.value.trim() == "") { alert("Please enter total income."); totalIncome3.value = ""; totalIncome3.focus(); return false; } if(totalExpenditure3.value.trim() == "") { alert("Please enter total expenditure."); totalExpenditure3.value = ""; totalExpenditure3.focus(); return false; } if(excess3.value.trim() == "") { alert("Please enter excess."); excess3.value = ""; excess3.focus(); return false; } if(auditStatus3.value == 0) { alert("Please upload a valid audit file."); return false; } totalLength = document.getElementsByName('totalSHGFormed[]').length; for(i=0;i<totalLength;i++) { ceoYear = document.getElementsByName('ceoYear[]'); totalSHGFormed = document.getElementsByName('totalSHGFormed[]'); totalSHGAdopted = document.getElementsByName('totalSHGAdopted[]'); totalSHGSavings = document.getElementsByName('totalSHGSavings[]'); totalSHGCredit = document.getElementsByName('totalSHGCredit[]'); totalLoan = document.getElementsByName('totalLoan[]'); ceoYear = document.getElementsByName('ceoYear[]'); regex=/^[0-9-, ]{4,}$/; //managementFileStatus =managementFileStatus[i] ; if(ceoYear[i].value.trim() == "") { alert("Please enter year."); ceoYear[i].value = ""; ceoYear[i].focus(); return false; } if(!regex.test(ceoYear[i].value)) { alert("Please enter the complete year."); ceoYear[i].value = ""; ceoYear[i].focus(); return false; } if(totalSHGFormed[i].value.trim() == "") { alert("Please enter total SHG formed."); totalSHGFormed[i].value = ""; totalSHGFormed[i].focus(); return false; } if(totalSHGAdopted[i].value.trim() == "") { alert("Please enter total SHG adopted."); totalSHGAdopted[i].value = ""; totalSHGAdopted[i].focus(); return false; } if(totalSHGSavings[i].value.trim() == "") { alert("Please enter total SHG savings."); totalSHGSavings[i].value = ""; totalSHGSavings[i].focus(); return false; } if(totalSHGCredit[i].value.trim() == "") { alert("Please enter total SHG credit."); totalSHGCredit[i].value = ""; totalSHGCredit[i].focus(); return false; } if(totalLoan[i].value.trim() == "") { alert("Please enter total loan."); totalLoan[i].value = ""; totalLoan[i].focus(); return false; } } if(excelUploadStatus.value != 1) { alert("Please upload file for loyalty List."); excelFile.value = ""; excelFile.focus(); return false; } /*if(ceoFileStatus.value == 0) { alert("Please upload a valid file."); return false; }*/ if(excelUploadStatus.value != 1) { alert("Please upload a valid excel file."); return false; } mfiYes = document.getElementById('mfiYes'); if(mfiYes.checked == true) { date = document.getElementById('mfiDate'); address = document.getElementById('mfiAddress'); //state = document.getElementById('state1'); //district = document.getElementById('district1'); //taluk = document.getElementById('taluk1'); totalActiveGroups = document.getElementById('mfiTotalActiveGroups'); mfiTotalLoan = document.getElementById('mfiTotalLoan'); outstanding = document.getElementById('mfiOutstanding'); outstandingGroups = document.getElementById('mfiOutstandingGroups'); //creditRating = document.getElementById('mfiCreditRatingName'); creditRatingName = document.getElementById('mfiCreditRatingName'); ratingAwarded = document.getElementById('mfiRatingAwarded'); mfiTotalExpenditure = document.getElementById('mfiTotalExpenditure'); //portfolio = document.getElementById('portfolio1'); repaymentRate = document.getElementById('mfiRepaymentRate'); //pack = document.getElementById('pack1'); totalGroups = document.getElementById('mfiTotalGroups'); //amount = document.getElementById('amount1'); npaAmount30 = document.getElementById('mfiNPAAmout30'); npaAmount60 = document.getElementById('mfiNPAAmout60'); npaAmount90 = document.getElementById('mfiNPAAmout90'); //return false; if(date.value.trim() == "") { alert("Please enter date of commencement of operation."); date.value = ""; date.focus(); return false; } if(address.value.trim() == "") { alert("Please enter address."); address.value = ""; address.focus(); return false; } /*if(state.value == 0) { alert("Please select state."); state.focus(); return false; } if(district.value == 0) { alert("Please select district."); district.focus(); return false; } if(taluk.value.trim() == "") { alert("Please enter taluk."); taluk.value = ""; taluk.focus(); return false; }*/ if(totalActiveGroups.value.trim() == "") { alert("Please enter total active groups."); totalActiveGroups.value = ""; totalActiveGroups.focus(); return false; } if(mfiTotalLoan.value.trim() == "") { alert("Please enter mfi total loan."); mfiTotalLoan.value = ""; mfiTotalLoan.focus(); return false; } if(outstanding.value.trim() == "") { alert("Please enter outstanding."); outstanding.value = ""; outstanding.focus(); return false; } if(outstandingGroups.value.trim() == "") { alert("Please enter number of outstanding groups."); outstandingGroups.value = ""; outstandingGroups.focus(); return false; } if(totalActiveGroups.value.trim() == "") { alert("Please enter total active groups."); totalActiveGroups.value = ""; totalActiveGroups.focus(); return false; } if(mfiTotalLoan.value.trim() == "") { alert("Please enter mfi total loan."); mfiTotalLoan.value = ""; mfiTotalLoan.focus(); return false; } if(outstanding.value.trim() == "") { alert("Please enter outstanding."); outstanding.value = ""; outstanding.focus(); return false; } /*if(creditRating.value.trim() == "") { alert("Please enter credit rating."); creditRating.value = ""; creditRating.focus(); return false; }*/ if(creditRatingName.value.trim() == "") { alert("Please enter credit rating name."); creditRatingName.value = ""; creditRatingName.focus(); return false; } if(ratingAwarded.value.trim() == "") { alert("Please enter rating awarded."); ratingAwarded.value = ""; ratingAwarded.focus(); return false; } if(npaAmount30.value.trim() == "") { alert("Please enter npaAmount30."); npaAmount30.value = ""; npaAmount30.focus(); return false; } if(npaAmount60.value.trim() == "") { alert("Please enter npaAmount60."); npaAmount60.value = ""; npaAmount60.focus(); return false; } if(npaAmount90.value.trim() == "") { alert("Please enter npaAmount90."); npaAmount90.value = ""; npaAmount90.focus(); return false; } /*if(mfiTotalExpenditure.value.trim() == "") { alert("Please enter total expenditure."); mfiTotalExpenditure.value = ""; mfiTotalExpenditure.focus(); return false; } /*if(portfolio.value == 0) { alert("Please select portfolio."); portfolio.focus(); return false; }*/ if(repaymentRate.value.trim() == "") { alert("Please enter repayment rate."); repaymentRate.value = ""; repaymentRate.focus(); return false; } /*if(pack.value.trim() == "") { alert("Please enter pack."); pack.value = ""; pack.focus(); return false; }*/ if(totalGroups.value.trim() == "") { alert("Please enter total groups."); totalGroups.value = ""; totalGroups.focus(); return false; } /*if(amount.value.trim() == "") { alert("Please enter amount."); amount.value = ""; amount.focus(); return false; }*/ } return true; } function profitLoss(i) { totalIncome = document.getElementById('totalIncome'+i).value; totalExpenditure = document.getElementById('totalExpenditure'+i).value; if(totalIncome != "" && totalExpenditure != "") { document.getElementById('excess'+i).value = totalIncome - totalExpenditure; } document.getElementById('excess'+i).readonly = true; } function number3(e) { var key = e.keyCode || e.charCode; if(key == 13 || key == 43 || (key >= 48 && key <= 57) || key == 8 || key == 46 || key==45) { return true; } else { return false; } } </script>