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

Language PHP Lines 404
MD5 Hash 39c6cc18745c6240fddcd48ff08f9ba4 Estimated Cost $104 (why?)
Repository https://bitbucket.org/jit_bec/shopifine.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<html>
    <head>
       <?php $this->load->view("common/header"); ?>
<!--        <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>-->
        <style>
            .column {
            float: left;
            padding: 1em;
            width:30%;
            }
            
            .extra-wide{
                width:95%;
            }
            .field{
                width:100%;
            }
            .ui-widget-header {height:12px;}
            .quote-column {
            float: left;
            padding-bottom: 0.5em;
            width: 95%;
            }
            .ui-combobox {
                width:14em;
            }
            .ui-combobox-input{
                width:12em;
            }
             #supplierOp-input{
                width:10em;
            }
            #warehouseOp-input{
                width:10em;
            }
             
            .calculated {
                color: green;
                font-size: 90%;
            }
            .row{
                width:95%;
            }
            
            .shopifine-ro-label {
                float: left;
                padding-right: 0.5em;
                width: 50%;
                word-wrap: break-word;
                color:#2E6E9E;
            }

            .shopifine-output {
             float: right;
             width: 45%;
             word-wrap: break-word;
             font-weight:bold;
            }
            
            .ui-tabs {
                height: 80%;
                margin: 0 auto;
                width: 70%;
                left:0;
            }
            #notetab {
                height:30em;
            }
            #details {
                height:12em;
            }
            .ui-tabs-nav{
                height:22px;
            }
            .labeldiv {
                color: #2E6E9E;
                float: left;
                font-size: 110%;
                font-weight: bold;
                margin-right: .5em;
                width: 35%;
                word-wrap: break-word;
            }
            .valuediv {
                float: left;
                font-weight: bold;
                width: 45%;
                word-wrap: break-word;
            }
            label.error {
                margin-right: .5em;
            }
            #status-message-li{
                color: red;
                font-size: 110%;
                font-style: italic;
                margin: 0 auto;
                width: 80%;
            }
            
            .table-grid {
                padding-top: 2em;
            }
            
         
            .help-message {
                color: green;
                float: right;
                font-size: 90%;
                font-style: italic;
                width: 65%;
            }
        </style>
       
        <script type="text/javascript">
                $(function() {
         $.validator.addMethod('tallyamount', function (value, el) {
            var already_paid = parseFloat($("#amount_paid_form").text());
            var pay_amount = parseFloat($("#amount").val());
            var total_invoiced_value = parseFloat($("#total_value_form").text());
            var prev_amount = $("#prev_amount").val();
            var total_paid= already_paid + pay_amount-prev_amount;
            if (total_paid>total_invoiced_value){
                return false;
            }
            
            else {
                return true;
            }
                },"Total Payment Exceeds Invoiced ");
                
        $.validator.addMethod('tallyadvance', function (value, el) {
            var advance_value = parseFloat($("#advance_value").text());
            var pay_amount = parseFloat($("#amount").val());
            var adjusted_advance = parseFloat($("#adjusted_advance").text());
            var prev_amount = $("#prev_amount").val();
            var total_paid= adjusted_advance + pay_amount - prev_amount;
            if (total_paid>advance_value){
                return false;
            }
            
            else {
                return true;
            }
                },"Total Adjusted Payment Exceeds Advance Payment ");
                
         $("#paymentForm").validate({rules:{
                 
                 amount:{                  
                     required:true,
                     number:true,
                     minStrict:0,
                     tallyamount:true,
                     tallyadvance:true
                 }
                 
         }}
     );
        // Main Request For Quotation Grid    
        
        
        
        var myGrid = $("#orders");
                
        var postData={_status:['pending','partiallypaid']}
        var settingsObj = {grid_id:'orders',pager:'pager',multiselect:true};
        
        prepareInvoicesGrid(settingsObj,postData,true,{},{},{});  
          
        myGrid.navGrid("#pager",{edit:false,add:false,view:false,del:false,search:false},{},{},{},{},{});
        var buttons ={manage:true,assign:true,mark_payer:true,load_owner_all:true};
        addCustomButtonsInVoiceGrid(settingsObj, buttons)  ;   
        myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
                
                //$("#del_orders").insertAfter("#add_orders");
            
        $( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 'auto',
            width: '55%',
            position:[300,25],
            modal: true,
            buttons: {
                
                Cancel: function() {

                    $( this ).dialog( "close" );
                }
            },
            open: function(event,ui){
                var invoice_id = myGrid.getGridParam('selrow');
                var settingsObj ={grid_id:'payments',pager:'pagerPayments',multiselect:true};
                var postData={invoiceId: myGrid.getGridParam('selrow')};
                var owner_id = myGrid.getCell(invoice_id,'owner_id');
                preparePaymentsGrid(settingsObj,postData);
                $("#payments").navGrid("#pagerPayments",{edit:false,add:false,del:false,search:false,view:true},{},{},{},{},{});
                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')}};
                addCustomButtonsInPaymentsGrid('payments','pagerPayments',null,btns);
                $("#payments").jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
                console.log(invoice_id);
                $("#invoice").text(myGrid.getCell(invoice_id,'reference'));
                $("#total_value").text(myGrid.getCell(invoice_id,'total_value'));
                $("#order_ref").text(myGrid.getCell(invoice_id,'order_reference'));
                $("#amount_paid").text(myGrid.getCell(invoice_id,'amount_paid'));
                

            },
            close: function(event,ui) {
                
                $("#estValue").text("");
                $("#curPrice").text("");
                $("#status-message-li").empty();
                
                $("#payments").jqGrid("GridUnload");
                myGrid.trigger("reloadGrid");
            }
        });    
        
        
    });     
    
     $(window).load(function(){
       
        var warningDialogs={one:true,none:true,status:true};
        initDialogs(warningDialogs);
        initPaymentDialog();
        initErrorDialogs({total:true,advance:true});
        $("#advance_ref").change(function(){
            $.ajax({
                url:"index.php/procurement/getPaymentDetails",
                type:"POST",
                data:{pay_id:$(this).val()                          
                },
                success:function (response){
                    var resObj = JSON.parse(response);
                     $(".paymentCntnr,#advancePaymentAmountCntnr").show();
                    $("#oper_payment").val("assign");
                    $("#payment_id").val(resObj.id);
                    $("#payment_ref").val(resObj.payment_reference);
                    $("#payment_mode").val(resObj.payment_mode);
                    $("#bankcomments").val(resObj.comments);
                    //$("#amount").val($("#payments").getCell(pay_id,'amount'));
                    $("#payment_ref").attr('readonly','readonly');
                    $("#payment_mode").attr('readonly','readonly');
                    $("#advance_value").text(resObj.amount);
                    $("#adjusted_advance").text(resObj.invoiced_amount);

                },
                error:function (response){

                }
            });
        });
    });

        </script>
        
    </head>
     
    <body>
        <?php  $this->load->view("common/menubar"); ?>
       <?php  $this->load->view("common/dialogs"); ?>
        
        <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">
            <?php  $this->load->view("common/message"); ?>
            <div class="table-grid">
                <h1 id="table header">Invoices To Pay</h1>
                <table id="orders"><tr><td/></tr></table> 
                <div id="pager"></div>
            </div>
            
        </div>
        <div id ="dialog-form">
           
             
            <h1 id="formHeader">Add Payments For Invoice #: <span id="invoice" name ="invoice" ></span>  </h1>   
           
                    <div id ="status-message-li" class="ui-corner-all">
                
                     </div>
                    <div class="row ">
                        <div class="column ">
                           <div class="field">
                                <div class="labeldiv">Total Value:</div>  
                                <div class="valuediv" id="total_value" name ="total_value" ></div>
                            </div>
                            
                        </div>
                        <div class="column ">
                            <div class="field">
                                <div class="labeldiv">Amount Paid :</div>  
                                <div class="valuediv" name="amount_paid" id="amount_paid" ></div>
                            </div>
                        </div> 
                        <div class="column ">
                            <div class="field">
                                <div class="labeldiv">Order Reference:</div>  
                                <div class="valuediv" name="order_ref" id="order_ref" ></div>
                            </div>
                        </div> 
                    </div>
                    
                    <div id ="status-message-li" class="ui-corner-all">
                
                    </div>
                    <div class="table-grid">
                        <h1 id="table_header_payment">Payment Details</h1>
                        <table id="payments"><tr><td/></tr></table> 
                        <div id="pagerPayments"></div>
                    </div>
                    
             
        </div>
<!--        <div id ="dialog-form-item">
            
            <h1 id="formHeader">Payment Details</h1>   
            <form id="paymentForm">
                <fieldset>
                    
                    
                    <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <div class="labeldiv">Total Value:</div>  
                                <div class="valuediv" id="total_value_form" name="total_value_form" ></div>                               
                            </div>
                           
                        </div>                        
                    </div>
                    <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <div class="labeldiv">Amount Paid:</div>  
                                <div class="valuediv" id="amount_paid_form" name="amount_paid_form" ></div>                               
                            </div>
                           
                        </div>                        
                    </div>
                    

                    <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <label for="payment_mode" class="labeldiv">Payment Type:</label>  
                                <select id="payment_mode" name ="payment_mode" class="required">
                                    <option value="">Choose..</option>
                                    <option value="cash">Cash</option>
                                    <option value="cheque">Cheque</option>
                                    <option value="draft">Draft</option>
                                    <option value="online">Online</option>
                                </select>
                                
                            </div>
                        </div>                        
                    </div>
                    <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <label for="payment_ref" class="labeldiv">Payment Reference:</label>  
                                <input id="payment_ref" name="payment_ref" class="required"/>
                                <div id ="receipt-help" class="ui-corner-all help-message">
                                    (Provide Cheque Number/Draft Number/Online Transaction Id)
                                </div>
                            </div>
                        </div>                        
                    </div>
                    
                    
                    <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <label for="amount" class="labeldiv">Amount:</label>  
                                <input id="amount" name="amount" />
                                
                            </div>
                        </div>                        
                    </div>
                     <div class="row single-column-row">
                        <div class="column quote-column single-column">
                            <div class="field">
                                <label for="comments" class="labeldiv">Bank Details:</label>  
                                <textarea id="bankcomments" name="bankcomments" row="5" col="40"></textarea>
                                <div id ="receipt-help" class="ui-corner-all help-message">
                                    (Provide Account # , Branch Etc:)
                                </div>
                            </div>
                        </div>                        
                    </div>
                    <input id="oper" name="oper" type="hidden" value=""/>
                    <input id="type" name="type" type="hidden" value=""/>
                    <input id="payment_id" name="payment_id" type="hidden" value=""/>
                    
                </fieldset>
            </form>
        </div>-->
        <?php $this->load->view("partial/footer"); ?>  
        
</body>   
</html>



    
   
Back to Top