PageRenderTime 40ms CodeModel.GetById 23ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/magehelp/application/views/procurement/invoice/purchase_invoice_grid.php

https://bitbucket.org/jit_bec/shopifine
PHP | 404 lines | 329 code | 67 blank | 8 comment | 4 complexity | 39c6cc18745c6240fddcd48ff08f9ba4 MD5 | raw file
  1<html>
  2    <head>
  3       <?php $this->load->view("common/header"); ?>
  4<!--        <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>-->
  5        <style>
  6            .column {
  7            float: left;
  8            padding: 1em;
  9            width:30%;
 10            }
 11            
 12            .extra-wide{
 13                width:95%;
 14            }
 15            .field{
 16                width:100%;
 17            }
 18            .ui-widget-header {height:12px;}
 19            .quote-column {
 20            float: left;
 21            padding-bottom: 0.5em;
 22            width: 95%;
 23            }
 24            .ui-combobox {
 25                width:14em;
 26            }
 27            .ui-combobox-input{
 28                width:12em;
 29            }
 30             #supplierOp-input{
 31                width:10em;
 32            }
 33            #warehouseOp-input{
 34                width:10em;
 35            }
 36             
 37            .calculated {
 38                color: green;
 39                font-size: 90%;
 40            }
 41            .row{
 42                width:95%;
 43            }
 44            
 45            .shopifine-ro-label {
 46                float: left;
 47                padding-right: 0.5em;
 48                width: 50%;
 49                word-wrap: break-word;
 50                color:#2E6E9E;
 51            }
 52
 53            .shopifine-output {
 54             float: right;
 55             width: 45%;
 56             word-wrap: break-word;
 57             font-weight:bold;
 58            }
 59            
 60            .ui-tabs {
 61                height: 80%;
 62                margin: 0 auto;
 63                width: 70%;
 64                left:0;
 65            }
 66            #notetab {
 67                height:30em;
 68            }
 69            #details {
 70                height:12em;
 71            }
 72            .ui-tabs-nav{
 73                height:22px;
 74            }
 75            .labeldiv {
 76                color: #2E6E9E;
 77                float: left;
 78                font-size: 110%;
 79                font-weight: bold;
 80                margin-right: .5em;
 81                width: 35%;
 82                word-wrap: break-word;
 83            }
 84            .valuediv {
 85                float: left;
 86                font-weight: bold;
 87                width: 45%;
 88                word-wrap: break-word;
 89            }
 90            label.error {
 91                margin-right: .5em;
 92            }
 93            #status-message-li{
 94                color: red;
 95                font-size: 110%;
 96                font-style: italic;
 97                margin: 0 auto;
 98                width: 80%;
 99            }
100            
101            .table-grid {
102                padding-top: 2em;
103            }
104            
105         
106            .help-message {
107                color: green;
108                float: right;
109                font-size: 90%;
110                font-style: italic;
111                width: 65%;
112            }
113        </style>
114       
115        <script type="text/javascript">
116                $(function() {
117         $.validator.addMethod('tallyamount', function (value, el) {
118            var already_paid = parseFloat($("#amount_paid_form").text());
119            var pay_amount = parseFloat($("#amount").val());
120            var total_invoiced_value = parseFloat($("#total_value_form").text());
121            var prev_amount = $("#prev_amount").val();
122            var total_paid= already_paid + pay_amount-prev_amount;
123            if (total_paid>total_invoiced_value){
124                return false;
125            }
126            
127            else {
128                return true;
129            }
130                },"Total Payment Exceeds Invoiced ");
131                
132        $.validator.addMethod('tallyadvance', function (value, el) {
133            var advance_value = parseFloat($("#advance_value").text());
134            var pay_amount = parseFloat($("#amount").val());
135            var adjusted_advance = parseFloat($("#adjusted_advance").text());
136            var prev_amount = $("#prev_amount").val();
137            var total_paid= adjusted_advance + pay_amount - prev_amount;
138            if (total_paid>advance_value){
139                return false;
140            }
141            
142            else {
143                return true;
144            }
145                },"Total Adjusted Payment Exceeds Advance Payment ");
146                
147         $("#paymentForm").validate({rules:{
148                 
149                 amount:{                  
150                     required:true,
151                     number:true,
152                     minStrict:0,
153                     tallyamount:true,
154                     tallyadvance:true
155                 }
156                 
157         }}
158     );
159        // Main Request For Quotation Grid    
160        
161        
162        
163        var myGrid = $("#orders");
164                
165        var postData={_status:['pending','partiallypaid']}
166        var settingsObj = {grid_id:'orders',pager:'pager',multiselect:true};
167        
168        prepareInvoicesGrid(settingsObj,postData,true,{},{},{});  
169          
170        myGrid.navGrid("#pager",{edit:false,add:false,view:false,del:false,search:false},{},{},{},{},{});
171        var buttons ={manage:true,assign:true,mark_payer:true,load_owner_all:true};
172        addCustomButtonsInVoiceGrid(settingsObj, buttons)  ;   
173        myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
174                
175                //$("#del_orders").insertAfter("#add_orders");
176            
177        $( "#dialog-form" ).dialog({
178            autoOpen: false,
179            height: 'auto',
180            width: '55%',
181            position:[300,25],
182            modal: true,
183            buttons: {
184                
185                Cancel: function() {
186
187                    $( this ).dialog( "close" );
188                }
189            },
190            open: function(event,ui){
191                var invoice_id = myGrid.getGridParam('selrow');
192                var settingsObj ={grid_id:'payments',pager:'pagerPayments',multiselect:true};
193                var postData={invoiceId: myGrid.getGridParam('selrow')};
194                var owner_id = myGrid.getCell(invoice_id,'owner_id');
195                preparePaymentsGrid(settingsObj,postData);
196                $("#payments").navGrid("#pagerPayments",{edit:false,add:false,del:false,search:false,view:true},{},{},{},{},{});
197                var btns = {add:true,edit:true,adjust:true,data:{type:'general',owner_id:owner_id,invoice_id:invoice_id,order_id:myGrid.getCell(invoice_id,'order_id')}};
198                addCustomButtonsInPaymentsGrid('payments','pagerPayments',null,btns);
199                $("#payments").jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
200                console.log(invoice_id);
201                $("#invoice").text(myGrid.getCell(invoice_id,'reference'));
202                $("#total_value").text(myGrid.getCell(invoice_id,'total_value'));
203                $("#order_ref").text(myGrid.getCell(invoice_id,'order_reference'));
204                $("#amount_paid").text(myGrid.getCell(invoice_id,'amount_paid'));
205                
206
207            },
208            close: function(event,ui) {
209                
210                $("#estValue").text("");
211                $("#curPrice").text("");
212                $("#status-message-li").empty();
213                
214                $("#payments").jqGrid("GridUnload");
215                myGrid.trigger("reloadGrid");
216            }
217        });    
218        
219        
220    });     
221    
222     $(window).load(function(){
223       
224        var warningDialogs={one:true,none:true,status:true};
225        initDialogs(warningDialogs);
226        initPaymentDialog();
227        initErrorDialogs({total:true,advance:true});
228        $("#advance_ref").change(function(){
229            $.ajax({
230                url:"index.php/procurement/getPaymentDetails",
231                type:"POST",
232                data:{pay_id:$(this).val()                          
233                },
234                success:function (response){
235                    var resObj = JSON.parse(response);
236                     $(".paymentCntnr,#advancePaymentAmountCntnr").show();
237                    $("#oper_payment").val("assign");
238                    $("#payment_id").val(resObj.id);
239                    $("#payment_ref").val(resObj.payment_reference);
240                    $("#payment_mode").val(resObj.payment_mode);
241                    $("#bankcomments").val(resObj.comments);
242                    //$("#amount").val($("#payments").getCell(pay_id,'amount'));
243                    $("#payment_ref").attr('readonly','readonly');
244                    $("#payment_mode").attr('readonly','readonly');
245                    $("#advance_value").text(resObj.amount);
246                    $("#adjusted_advance").text(resObj.invoiced_amount);
247
248                },
249                error:function (response){
250
251                }
252            });
253        });
254    });
255
256        </script>
257        
258    </head>
259     
260    <body>
261        <?php  $this->load->view("common/menubar"); ?>
262       <?php  $this->load->view("common/dialogs"); ?>
263        
264        <div style="display: block;height: 100%;" class="shopifine-ui-dialog ui-widget ui-widget-content ui-corner-all" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-form">
265            <?php  $this->load->view("common/message"); ?>
266            <div class="table-grid">
267                <h1 id="table header">Invoices To Pay</h1>
268                <table id="orders"><tr><td/></tr></table> 
269                <div id="pager"></div>
270            </div>
271            
272        </div>
273        <div id ="dialog-form">
274           
275             
276            <h1 id="formHeader">Add Payments For Invoice #: <span id="invoice" name ="invoice" ></span>  </h1>   
277           
278                    <div id ="status-message-li" class="ui-corner-all">
279                
280                     </div>
281                    <div class="row ">
282                        <div class="column ">
283                           <div class="field">
284                                <div class="labeldiv">Total Value:</div>  
285                                <div class="valuediv" id="total_value" name ="total_value" ></div>
286                            </div>
287                            
288                        </div>
289                        <div class="column ">
290                            <div class="field">
291                                <div class="labeldiv">Amount Paid :</div>  
292                                <div class="valuediv" name="amount_paid" id="amount_paid" ></div>
293                            </div>
294                        </div> 
295                        <div class="column ">
296                            <div class="field">
297                                <div class="labeldiv">Order Reference:</div>  
298                                <div class="valuediv" name="order_ref" id="order_ref" ></div>
299                            </div>
300                        </div> 
301                    </div>
302                    
303                    <div id ="status-message-li" class="ui-corner-all">
304                
305                    </div>
306                    <div class="table-grid">
307                        <h1 id="table_header_payment">Payment Details</h1>
308                        <table id="payments"><tr><td/></tr></table> 
309                        <div id="pagerPayments"></div>
310                    </div>
311                    
312             
313        </div>
314<!--        <div id ="dialog-form-item">
315            
316            <h1 id="formHeader">Payment Details</h1>   
317            <form id="paymentForm">
318                <fieldset>
319                    
320                    
321                    <div class="row single-column-row">
322                        <div class="column quote-column single-column">
323                            <div class="field">
324                                <div class="labeldiv">Total Value:</div>  
325                                <div class="valuediv" id="total_value_form" name="total_value_form" ></div>                               
326                            </div>
327                           
328                        </div>                        
329                    </div>
330                    <div class="row single-column-row">
331                        <div class="column quote-column single-column">
332                            <div class="field">
333                                <div class="labeldiv">Amount Paid:</div>  
334                                <div class="valuediv" id="amount_paid_form" name="amount_paid_form" ></div>                               
335                            </div>
336                           
337                        </div>                        
338                    </div>
339                    
340
341                    <div class="row single-column-row">
342                        <div class="column quote-column single-column">
343                            <div class="field">
344                                <label for="payment_mode" class="labeldiv">Payment Type:</label>  
345                                <select id="payment_mode" name ="payment_mode" class="required">
346                                    <option value="">Choose..</option>
347                                    <option value="cash">Cash</option>
348                                    <option value="cheque">Cheque</option>
349                                    <option value="draft">Draft</option>
350                                    <option value="online">Online</option>
351                                </select>
352                                
353                            </div>
354                        </div>                        
355                    </div>
356                    <div class="row single-column-row">
357                        <div class="column quote-column single-column">
358                            <div class="field">
359                                <label for="payment_ref" class="labeldiv">Payment Reference:</label>  
360                                <input id="payment_ref" name="payment_ref" class="required"/>
361                                <div id ="receipt-help" class="ui-corner-all help-message">
362                                    (Provide Cheque Number/Draft Number/Online Transaction Id)
363                                </div>
364                            </div>
365                        </div>                        
366                    </div>
367                    
368                    
369                    <div class="row single-column-row">
370                        <div class="column quote-column single-column">
371                            <div class="field">
372                                <label for="amount" class="labeldiv">Amount:</label>  
373                                <input id="amount" name="amount" />
374                                
375                            </div>
376                        </div>                        
377                    </div>
378                     <div class="row single-column-row">
379                        <div class="column quote-column single-column">
380                            <div class="field">
381                                <label for="comments" class="labeldiv">Bank Details:</label>  
382                                <textarea id="bankcomments" name="bankcomments" row="5" col="40"></textarea>
383                                <div id ="receipt-help" class="ui-corner-all help-message">
384                                    (Provide Account # , Branch Etc:)
385                                </div>
386                            </div>
387                        </div>                        
388                    </div>
389                    <input id="oper" name="oper" type="hidden" value=""/>
390                    <input id="type" name="type" type="hidden" value=""/>
391                    <input id="payment_id" name="payment_id" type="hidden" value=""/>
392                    
393                </fieldset>
394            </form>
395        </div>-->
396        <?php $this->load->view("partial/footer"); ?>  
397        
398</body>   
399</html>
400
401
402
403    
404