src/ApplicationBundle/Resources/views/modals/input_forms/add_receipt.html.twig line 1

Open in your IDE?
  1. <!-- Modal -->
  2. <div class="modal fade" id="newReceiptModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  3.     <div class="modal-dialog" role="document">
  4.         <form class="form-horizontal addCreatedByDataForm modalFormReceipt" method="post" action="{{ url('add_receipt') }}" >
  5.             <div class="modal-content">
  6.                 <div class="modal-header">
  7.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  8.                     <h4 class="modal-title" id="myModalLabel">Add New Receipt</h4>
  9.                 </div>
  10.                 <div class="modal-body">
  11.                     <div class="form-group">
  12.                         <label for="inputEmail3" class="col-sm-4 control-label">Receipt Date</label>
  13.                         <div class="col-sm-8">
  14.                             <input  name="receipt_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
  15.                         </div>
  16.                     </div>
  17.                     <div class="form-group">
  18.                         <label for="inputEmail3" class="col-sm-4 control-label">Receipt Type</label>
  19.                         <div class="col-sm-8">
  20.                             <select class="form-control  add_receipt_modal_receipt_type filter_by_this" name="receipt_type">
  21.                                 {#{% for category in itemgroup %}#}
  22.                                 <option value="1">From Client </option>
  23.                                 <option value="2">To Employee </option>
  24.                                 <option value="3">Against A/C Head </option>
  25.                                 {#{% endfor %}#}
  26.                             </select>
  27.                         </div>
  28.                     </div>
  29.                     <div class="form-group">
  30.                         <label for="inputEmail3" class="col-sm-4 control-label">Receive As</label>
  31.                         <div class="col-sm-8">
  32.                             <select class="form-control  filter_by_this add_receipt_modal_receipt_sub_type" name="receipt_sub_type" >
  33.                                 {#{% for category in itemgroup %}#}
  34.                                 <option value="1">Party Receipt</option>
  35.                                 <option value="2">Advance</option>
  36.                                 <option value="3">Loan</option>
  37.                                 {#{% endfor %}#}
  38.                             </select>
  39.                         </div>
  40.                     </div>
  41.                     <div class="form-group">
  42.                         <label for="inputEmail3" class="col-sm-4 control-label">Amount</label>
  43.                         <div class="col-sm-8">
  44.                             <input type="number" name="receipt_amount" class="form-control add_receipt_modal_receipt_amount" id="receipt_amount" placeholder="Amount">
  45.                         </div>
  46.                     </div>
  47.                     <div class="form-group  filter filter-default filter-1">
  48.                         <label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
  49.                         <div class="col-sm-8">
  50.                             {% set head_list=''|ClientList %}
  51.                             {#{{ dump(head_list) }}#}
  52.                             <select class="form-control  add_receipt_modal_receipt_from_1 change_check_narration" name="receipt_from_1">
  53.                                 {% for head in head_list %}
  54.                                     <option value="{{ head.ClientId }}">{{ head.clientName }} ( Due: {{ head.clientDue }} )</option>
  55.                                 {% endfor %}
  56.                             </select>
  57.                             <input type="text" name="receipt_from_note_1" class="form-control add_receipt_modal_receipt_from_note_3"  placeholder="Notes about this">
  58.                         </div>
  59.                     </div>
  60.                     <div class="form-group filter filter-2">
  61.                         <label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
  62.                         <div class="col-sm-8">
  63.                             {% set head_list='rv'|GetParentLedgerHeads %}
  64.                             <select class="form-control selectize_me change_check_narration" name="receipt_from_2">
  65.                                 {% if head_list.CREDIT_HEADS is defined %}
  66.                                     {% for head in head_list.CREDIT_HEADS %}
  67.                                         <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  68.                                     {% endfor %}
  69.                                 {% endif %}
  70.                             </select>
  71.                             <input type="text" name="receipt_from_note_2" class="form-control"   placeholder="Notes about this">
  72.                         </div>
  73.                     </div>
  74.                     <div class="form-group filter filter-3">
  75.                         <label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
  76.                         <div class="col-sm-8">
  77.                             <select class="form-control selectize_me change_check_narration" name="receipt_from_3">
  78.                                 {% if head_list.CREDIT_HEADS is defined %}
  79.                                     {% for head in head_list.CREDIT_HEADS %}
  80.                                         <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  81.                                     {% endfor %}
  82.                                 {% endif %}
  83.                             </select>
  84.                             <input type="text" name="receipt_from_note_3" class="form-control add_receipt_modal_receipt_from_note_3"   placeholder="Notes about this">
  85.                         </div>
  86.                     </div>
  87.                     <div class="form-group">
  88.                         <label for="inputEmail3" class="col-sm-4  control-label">Receive On</label>
  89.                         <div class="col-sm-8">
  90.                             {#{% set head_list='pv'|GetParentLedgerHeads %}#}
  91.                             <select class="form-control add_receipt_modal_receipt_to receipt_change_check_number" name="receipt_to">
  92.                                 <option value="">Select</option>
  93.                                 {% if head_list.DEBIT_HEADS is defined %}
  94.                                     {% for head in head_list.DEBIT_HEADS %}
  95.                                         <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  96.                                     {% endfor %}
  97.                                 {% endif %}
  98.                             </select>
  99.                             <input type="text" name="receipt_from_note" class="form-control"   placeholder="Notes about this">
  100.                         </div>
  101.                     </div>
  102.                     <div class="form-group">
  103.                         <label for="inputEmail3" class="col-sm-4 control-label">Received Amount</label>
  104.                         <div class="col-sm-8">
  105.                             <input type="number" name="receipt_deposit_amount" class="form-control" value="0" id="add_receipt_modal_receipt_deposit_amount" placeholder="Amount">
  106.                         </div>
  107.                     </div>
  108.                     <div class="form-group  receipt_check_number_div">
  109.                         <label for="inputEmail3" class="col-sm-4 control-label">Check Number/Tx Id</label>
  110.                         <div class="col-sm-8">
  111.                             <input type="text" name="receipt_check_number" class="form-control" id="receipt_check_number_here" placeholder="">
  112.                             <input  name="check_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
  113.                             <input type="text" name="check_narration" class="form-control" id="receipt_check_narration" placeholder="Check Narration (default)" value="">
  114.                             <input type="hidden" name="check_id" class="form-control" id="receipt_check_id" placeholder="">
  115.                         </div>
  116.                     </div>
  117.                     <div class="form-group">
  118.                         <label for="inputEmail3" class="col-sm-4  control-label">Bank or Other Charges Head</label>
  119.                         <div class="col-sm-8">
  120.                             {% set head_list='exp'|GetParentLedgerHeads %}
  121.                             <select class="form-control add_receipt_modal_receipt_charge_head selectize_me" name="receipt_charge_head">
  122.                                 <option value="">Select</option>
  123.                                 {#{% if head_list.DEBIT_HEADS is defined %}#}
  124.                                     {% for head in head_list %}
  125.                                         <option value="{{ head['id'] }}">{{ head['text'] }}</option>
  126.                                     {% endfor %}
  127.                                 {#{% endif %}#}
  128.                             </select>
  129.                             <input type="text" name="receipt_charge_note" class="form-control"   placeholder="Notes about this">
  130.                         </div>
  131.                     </div>
  132.                     <div class="form-group">
  133.                         <label for="inputEmail3" class="col-sm-4 control-label">Charge Amount</label>
  134.                         <div class="col-sm-8">
  135.                             <input type="number" name="receipt_charge_amount" class="form-control" value="0" id="add_receipt_modal_receipt_charge_amount" placeholder="Amount">
  136.                         </div>
  137.                     </div>
  138.                     <div class="form-group">
  139.                         <label for="inputEmail3" class="col-sm-4 control-label">Description</label>
  140.                         <div class="col-sm-8">
  141.                             <textarea name="description" rows="3" class="form-control"   placeholder="Narration"></textarea>
  142.                         </div>
  143.                     </div>
  144.                     <div class="form-group filter filter-default filter-1">
  145.                         <label for="inputEmail3" class="col-sm-4 control-label"></label>
  146.                         <div class="col-sm-8">
  147.                             <input type="checkbox"  name="auto_balance_1" value="1" id="exp_check_auto_balance" checked>
  148.                             <label for="exp_check_auto_balance">Automatically Balance Invoice and Order</label>
  149.                         </div>
  150.                         <input type="hidden" id="AddReceiptModalSpecialType" name="AddReceiptModalSpecialType" value="">
  151.                         <input type="hidden" id="AddReceiptModalSpecialTypeSoDocId" name="AddReceiptModalSpecialTypeSoDocId" value="">
  152.                         <input type="hidden" id="AddReceiptModalSpecialTypeSiDocId" name="AddReceiptModalSpecialTypeSiDocId" value="">
  153.                     </div>
  154.                 </div>
  155.                 <div class="modal-footer">
  156.                     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  157.                     <button type="submit" class="btn btn-primary">Save</button>
  158.                 </div>
  159.             </div>
  160.         </form>
  161.     </div>
  162. </div>
  163. <script>
  164.     var add_receipt_modal_receipt_type_selector={}
  165.     var add_receipt_modal_receipt_sub_type_selector={}
  166.     var add_receipt_modal_receipt_from_1_selector={}
  167.     var add_receipt_modal_receipt_to_selector={}
  168. //    var add_receipt_modal_receipt_sub_type_selector={}
  169.     // wait for the DOM to be loaded
  170.     var SINGLE_CHECK_LIST={{ ''|GetSingleCheckList|json_encode()|raw  }}
  171.             {#var HEAD_LIST={{ ''|GetParentLedgerHeads|json_encode()|raw  }}#}
  172.             $(document).ready(function() {
  173.                 var $add_receipt_modal_receipt_type_selector= $('.add_receipt_modal_receipt_type').selectize()
  174.                 add_receipt_modal_receipt_type_selector= $add_receipt_modal_receipt_type_selector[0].selectize
  175.                 var $add_receipt_modal_receipt_sub_type_selector= $('.add_receipt_modal_receipt_sub_type').selectize()
  176.                 add_receipt_modal_receipt_sub_type_selector= $add_receipt_modal_receipt_sub_type_selector[0].selectize ;
  177.                 var $add_receipt_modal_receipt_from_1_selector= $('.add_receipt_modal_receipt_from_1').selectize()
  178.                 add_receipt_modal_receipt_from_1_selector= $add_receipt_modal_receipt_from_1_selector[0].selectize
  179.                 var $add_receipt_modal_receipt_to_selector= $('.add_receipt_modal_receipt_to').selectize()
  180.                 add_receipt_modal_receipt_to_selector= $add_receipt_modal_receipt_to_selector[0].selectize
  181.                 var receiptOptions = {
  182. //            target:        '#output1',   // target element(s) to be updated with server response
  183. //            dataType:  null  ,      // 'xml', 'script', or 'json' (expected server response type)
  184.                     beforeSubmit:  function(arr, $form, options) {
  185. //                        alertify.set({ delay: 5000 });
  186. //                        alertify.alert('Please Wait..');
  187.                     },
  188.                     success:       showResponseReceipt  // post-submit callback
  189.                 };
  190.                 function showResponseReceipt(responseText, statusText, xhr, $form)  {
  191.                     if(statusText=='success') {
  192.                         if(responseText.success==true) {
  193. //                        alertify.closeAll();
  194.                             alertify.success("Receipt Added");
  195.                             if ($('.AddReceiptModalSpecialType').val() != '') {
  196.                                 if (typeof this_view_page !== 'undefined') {
  197.                                     alertify.alert('Successfully Added The Receipt. Document Name: '+responseText.docHash+'. Reloading in 2 seconds');
  198.                                     setTimeout(function () {
  199.                                         window.location.href = this_view_page;
  200.                                     }, 2000);
  201.                                 }
  202.                                 else
  203.                                     alertify.alert('Successfully Added The Receipt . Document Name: '+responseText.docHash);
  204.                             }
  205.                             else {
  206.                                 alertify.alert('Successfully Added The Receipt . Document Name: '+responseText.docHash);
  207.                             }
  208.                         }
  209.                         else
  210.                         {
  211. //                        alertify.closeAll();
  212.                             alertify.alert('Sorry could not Perform The action');
  213.                             alertify.error("Action failed");
  214.                             addCreateConfirmed = 0;
  215.                         }
  216.                     }
  217.                     else
  218.                     {
  219. //                        alertify.closeAll();
  220.                         alertify.alert('Sorry could not Perform The action');
  221.                         alertify.error("Action failed");
  222.                         addCreateConfirmed = 0;
  223.                     }
  224.                     //    console.log(responseText)
  225. //                    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
  226. //                            '\n\nThe output div should have already been updated with the responseText.');
  227. //                    //    console.log('status: ' + statusText + '\n\nresponseText: \n' + responseText +
  228. //                            '\n\nThe output div should have already been updated with the responseText.');
  229.                 }
  230.                 $('.modalFormReceipt').ajaxForm(receiptOptions);
  231.                 $('.filter').hide();
  232.                 $('.filter-default').show();
  233.                 $('.filter_by_this').change(function(){
  234. //            alert('here')
  235.                     var filter_ind=$(this).val()
  236.                     $('.filter').hide();
  237.                     $('.filter-'+filter_ind).show();
  238.                 })
  239. //
  240. //
  241. //                $('.receipt_change_check_number').change(function(){
  242. ////            alert('here')
  243. //                    var filter_ind=$(this).val()
  244. ////            $('.filter').hide();
  245. //                    if(SINGLE_CHECK_LIST[filter_ind]) {
  246. //                        $('#receipt_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
  247. ////                        alert(SINGLE_CHECK_LIST[filter_ind].id)
  248. //                        $('#receipt_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
  249. ////                        alert($('#check_id').val())
  250. //                        $('.receipt_check_number_div').show();
  251. //                    }
  252. //                    else {
  253. //                        $('#receipt_check_number_here').val('');
  254. //                        $('#receipt_check_id').val('');
  255. //                        $('.receipt_check_number_div').hide();
  256. //                    }
  257. //
  258. //                })
  259. //                $('.expense_change_check_number').change(function(){
  260. ////            alert('here')
  261. //                    var filter_ind=$(this).val()
  262. ////            $('.filter').hide();
  263. //                    if(SINGLE_CHECK_LIST[filter_ind]) {
  264. //                        $('#expense_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
  265. ////                        alert(SINGLE_CHECK_LIST[filter_ind].id)
  266. //                        $('#expense_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
  267. ////                        alert($('#check_id').val())
  268. //                        $('.expense_check_number_div').show();
  269. //                    }
  270. //                    else {
  271. //                        $('#expense_check_number_here').val('');
  272. //                        $('#expense_check_id').val('');
  273. //                        $('.expense_check_number_div').hide();
  274. //                    }
  275. //
  276. //                })
  277.             });
  278. </script>