EVOLUTION-NINJA
Edit File: purchase_order.php
<script src="<?php echo base_url('assets/toastr/toastr.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('assets/toastr/toastr.min.css');?>"> <style type="text/css"> .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #editmodlist2 { //height: 232px !important; width: 326px !important; } #FrmGrid_list2 { width: 100% !important; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color:#2A4474 !important; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 43%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; background-color: #2A4474!important; color:white !important; } .ui-jqgrid-bdiv { height: 232px !important; } .ui-widget-overlay { z-index:0 !important; } </style> <div class="content-wrapper"> <div class="main-container ace-save-state print" id="main-container"> <script type="text/javascript"> try{ace.settings.loadState('main-container')}catch(e){} </script> <div class="main-content"> <div class="main-content-inner"> <div class="main-container ace-save-state " id="main-container"> <div class="main-content"> <div class="main-content-inner"> <div class="page-content"> <div class="row"> <div class="col-sm-12 col-md-1"> <!-- <a href="<?php echo site_url('controller/po_edit?id='.$id);?>"><i class="fa fa-long-arrow-left fa-2x" style="color:#438EB9;"></i></a>--> <a href="<?php echo site_url('controller/create_po');?>"><i class="fa fa-long-arrow-left fa-2x" style="color:#438EB9;"></i></a> </div> </div> <div class="row"> <div class="pdf"> <div class="col-sm-12"> <center style="color:#438EB9;"><h2><b>Purchase Order</b></h2></center> <table width="100%;"> <tr> <td style="padding-top:29px;"> <input type="hidden" value=""/> <table style="border:1px solid #000;padding:5px;width:100%;"> <tr><td>Yaskawa India Private Limited</td> </tr> <tr> <td>Plot No. 17/A, Electronic City, Phase I, Bangalore </td> </tr> <tr> <td>Tel : (080) 2200-0000, Fax : (080) 2200-0000</td> </tr> <tr> <td>GSTIN -29AAACY4408P1ZR</td> </tr> </table> </td><!---table1---> <td style="padding-top:29px;"> <input type="hidden" value="<?php echo $po;?>" id="po_id"/> <table style="border:1px solid #000;padding:5px;width:100%;"> <tr> <td>P. O. No#</td> <td style="text-align:right;"><?php echo $po;?></td> </tr> <tr> <td>Date</td> <td style="text-align:right;"><?php echo date("d-m-Y"); ?></td> </tr> <tr> <td>Your Ref#</td> <td> </td> </tr> <tr> <td>Our Ref#</td> <td> </td> </tr> </table> </td><!---table2---> </tr> <tr> <td style="padding:5px;"></td> </tr> <tr> <td> <table style="border:1px solid #000;width:100%;"> <tr> <td>Transaction Type </td> <td>Domestic</td> </tr> <tr> <td>Nature of Transaction </td> <td>Inter-State Purchase / Intra-State Purchase</td> </tr> <tr> <td>Nature of Supply</td> <td>Goods / Services / Goods & Services</td> </tr> </table> </td><!---table3---> <td> </td><!---table4---> </tr> <tr> <td> <p style="padding-top:30px;"><i><b>Billing To</b></i></p> <table style="border:1px solid #000;width:100%;"> <tr> <td colspan="2"><b><?php echo $address->billadd1;?></b></td> </tr> <tr> <td colspan="2"><?php echo $address->billadd2;?></td> </tr> <tr> <td><?php echo $address->billadd4;?></td> <td>State Code: <?php echo $address->billstate_code;?></td> </tr> <tr> <td>India</td> <td></td> </tr> <tr> <td>GSTIN: </td> <td><?php echo $address->billadd5;?></td> </tr> <!-- <tr> --> <!-- <td>TN-GSTIN</td> --> <!-- <td>29AAACY4408P1ZR</td> --> <!-- </tr> --> </table> <p>Attention To : Contact Person/ contact no /email-id</p> </td><!---table5---> <td> <p style="padding-top:30px;"><i><b>Deliver To</b></i></p> <table style="border:1px solid #000;width:100%;"> <tr> <td colspan="2"><b><?php echo $address->shipadd1;?></b></td> </tr> <tr> <td colspan="2"><?php echo $address->shipadd2;?></td> </tr> <tr> <td><?php echo $address->shipadd4;?></td> <td>State Code:<?php echo $address->shipstate_code;?></td> </tr> <tr> <td>India</td> <td></td> </tr> <tr> <td>GSTIN: </td> <td><?php echo $address->shipadd5;?></td> </tr> <!-- <tr> --> <!-- <td>TN-GSTIN</td> --> <!-- <td>29AAACY4408P1ZR</td> --> <!-- </tr> --> </table> <p>Attention To : Contact Person</p> </td><!---table6---> </tr> </table> </div> <div class="col-sm-12"> <table class="table table-bordered table-striped table-hover table-condensed table-responsive" border="1" style="border-spacing:0 !important;"> <tbody> <tr> <th width="8%">HSN/SA CODE</th> <th width="20%">Description</th> <th width="2%" >Qty</th> <th width="2%" >Delivery Date</th> <th width="5%">Unit</th> <th width="5%">Unit<br>Price</th> <th width="5%">Trade <br>Discount</th> <th width="5%">Cash <br> Discount</th> <th width="5%">Unit Net<br>Price</th> <th width="5%">Base <br>Price</th> <th width="5%">IGST<br> Rate </th> <th width="5%">IGST <br>Amount </th> <th width="5%">SGST <br> Rate</th> <th width="5%">SGST <br>Amount </th> <th width="5%">CGST <br>Rate</th> <th width="5%">CGST <br>Amount </th> <th width="5%">Total <br> Amount </th> </tr> <?php $cts=0; $tax=0; $inv=0; $fri=0; $paid=0; $due=0;foreach($po_details as $ct){ ?> <tr> <td><?php echo $ct->hsn; ?></td> <td><?php echo $ct->description; ?></td> <td><?php echo $ct->quantity; ?></td> <td><?php echo $ct->delivery_date; ?></td> <td><?php echo $ct->unit; ?></td> <td><i class="fa fa-inr"><?php echo $ct->price; ?></i></td> <td><?php echo $ct->trade; ?></td> <td><?php echo $ct->cash; ?> </td> <td> <i class="fa fa-inr"><?php echo $ct->net; ?></i></td> <td> <i class="fa fa-inr"><?php echo $ct->base; ?></i></td> <?php $base = $ct->base; $base1 = str_replace( ',', '', $base ); ?> <td><?php echo $ct->igst; ?></td> <td><i class="fa fa-inr"><?php if($ct->igst >0){ $c=(($base1 *$ct->igst)/100);} else{$c=0;} echo number_format($c); ?></i></td> <td><?php echo $ct->sgst; ?> </td> <td> <i class="fa fa-inr"><?php if($ct->sgst >0){ $a=(($base1 *$ct->sgst)/100);} else{$a=0;} echo number_format($a); ?></i></td> <td> <?php echo $ct->cgst; ?></td> <td> <i class="fa fa-inr"><?php if($ct->cgst >0){ $b=(($base1 *$ct->cgst)/100);} else{$b=0;} echo number_format($b); ?></i></td> <td> <i class="fa fa-inr"><?php $tv=$base1 +$a+$b+$c; echo number_format($tv); ?></i></td> </tr> <?php $cts=$cts+$tv; $tot = number_format($cts); $tax=$tax+($a + $b)+ $c; $inv=$ct->invoice; $fri=$ct->frieght; $paid=$ct->paid; $due=$ct->due;} ?> <tr> <td colspan="4" rowspan="7" style="width:100%; border:transparent;text-transform: uppercase !important;"> <h4>Comments:</h4><br/> <?php foreach($po_details as $pos) {?> <?php echo $pos->note; ?> <?php break; } ?> </td> <td colspan="12">Sub Total</td> <td><?php echo $tot; ?></td> </tr> <!--<tr> <td colspan="12">Total Tax to be charged by Supplier on Invoice</td> <td><?php //echo $tax; ?></td> </tr> <tr> <td colspan="12">Tax to be paid by Recipient under Reverse Charge</td> <td>0</td> </tr>--> <tr> <td colspan="12">Freight</td> <td><?php echo $fri; ?></td> </tr> <tr> <td colspan="12">Invoice Total</td> <td><?php echo $inv; ?></td> </tr> <tr> <td colspan="12">Amount Paid</td> <td><?php echo $paid; ?></td> </tr> <tr> <td colspan="12">Balance Due</td> <td><?php echo $due; ?></td> </tr> </tbody> </table> </div> <?php foreach($po_details as $po) {?> <div class="terms" style="padding:15px !important;margin-left:10px;"> <label>Terms & Conditions</label> <div> <p>1. Material Delivery: <?php echo $po->delivery; ?></p><br> <p>2. Tax: <?php echo $po->taxes; ?></p><br> <p>3. Terms of Payment : <?php echo $po->term; ?></p><br> <p>4. Bank Details: <?php echo $po->bank; ?></p><br> </div> <?php break; }?> </div> </div> <form> <center><input type="checkbox" id="confirm" required/> <label>By clicking confirm I agree to release this purchase order</label></center> <center><button type="button" class="btn btn-primary btn-sm newtab" id="cmd">Confirm</button></center> </form> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.page-content --><!--data-toggle="modal" data-target="#myModal"--> </div> </div><!-- /.main-content --> <div class="pdf_file"></div> <div class="footer" style="padding-left:10px;"> <div class="footer-inner"> <div class="footer-content"> <span class="bigger-120"> <span class="blue">All Right Reserved © 2017</span> <a href=""> Jay Blues Technologies</a> </span> </div> </div> </div> <!-- Modal --> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Upload Digital Signature</h4> </div> <div class="modal-body"> <input type="file"> </div> <div id="editor"></div> <div class="modal-footer"> <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal" >Submit</button> <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" onclick="cancel_upload()">Cancel</button> </div> </div> </div> </div> <!------------------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="newModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Upload File</h4> </div> <form id="upload" class="form-inline upload_pdf" enctype="multipart/form-data"> <div class="modal-body"> <input type="hidden" name="po_no" value="<?php echo $po->po_no;?>"> <div class="file-uploader"> <div class="file-uploader__message-area"> <p>Upload PDF file.</p> </div> <div class="file-chooser"> <input type="file" id="file" class="pdf_upload" name="pdf_file[]" multiple required="required"> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit_pdf">Upload</button> </div> </form> </div> </div> </div> <!------------------------------------------------------------------> <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> </a> </div> </div> </div><!-- /.main-container --> </div> <style> table td{ padding-left:10px; padding-right:10px; } </style> <script src="<?php echo base_url(); ?>assets/js/sweetalert.min.js" type="text/javascript"></script> <link href="<?php echo base_url(); ?>assets/css/sweetalert.css" rel="stylesheet" type="text/css" > <script type="text/javascript" src="<?php echo base_url('assets/js/jspdf.debug.js');?>"></script> <script> $(document).ready(function(){ //$('#newModal').modal('show'); }) //var divContents = $(".print").html(); //newWin= window.open(""); //newWin.document.write(divContents); //newWin.print(); //newWin.close(); var doc = new jsPDF(); var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#cmd').click(function () { // function test() // { //alert(); if (jQuery("#confirm").prop("checked")){ swal({ title: "Are you sure?", text: "You want to Generate this PO!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, Generate it!", cancelButtonText: "No, cancel please!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".confirm").attr('disabled', 'disabled'); $(".confirm").text("Loading"); var str= $("#po_id").val(); //alert(str); $.ajax({ url:"<?php echo base_url('controller/conversion');?>", type:"GET", success:function(response) { if(response == 1) { $.ajax({ url:"<?php echo base_url('controller/confirm_PO');?>", type:"POST", data:{'id':str}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $(".confirm").text("Yes, Generate it!"); $(".confirm").removeAttr('disabled'); // response=jQuery.parseJSON(response); // console.log(response); window.open('<?php echo base_url('')?>'+response.message+'', '_blank'); //swal("Generated!", "Your PO has been Generated.", "success"); swal({ title: "To Transfer", text: "YASKAWA INDIA!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, Transfer it!", cancelButtonText: "No, cancel please!", closeOnConfirm: true, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('#newModal').modal('show'); } else { var reply = "PENDING"; var po= $("#po_id").val(); $.ajax({ url:"<?php echo base_url('controller/transfer_cancelled');?>", type:"POST", data:{'reply':reply,'po':po}, success:function(response) { swal("Cancelled", "Transfer Cancelled :)", "error"); window.location.href = "<?php echo base_url('controller/po_list');?>" } }); } }); } } }); } } }); } else { swal("Cancelled", "Your PO is not Generated :)", "error"); } }); } else { swal({ title: "Please Confirm this Purchase Order", text: "", }); } }); function cancel_upload() { swal({ title: "Are you sure?", text: "You want to cancel Generating this PO!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, cancel it!", cancelButtonText: "No!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { swal("Cancelled!", "Your Generate PO function is cancelled.", "success"); } else { swal("Continued", "Your Generate PO function is continued. :)", "error"); } }); } $('.upload_pdf').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("controller/upload_po_pdf")?>', data : formdata, contentType: false, processData: false, //async : false, success:function(data){ $('#newModal').modal('hide'); toastr["success"]("Succesfully Uploaded"); window.location.href = "<?php echo base_url('controller/po_list');?>" } }); }); </script>