<!-- Modal -->
<div class="modal fade" id="newReceiptModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<form class="form-horizontal addCreatedByDataForm modalFormReceipt" method="post" action="{{ url('add_receipt') }}" >
<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">Add New Receipt</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Receipt Date</label>
<div class="col-sm-8">
<input name="receipt_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Receipt Type</label>
<div class="col-sm-8">
<select class="form-control add_receipt_modal_receipt_type filter_by_this" name="receipt_type">
{#{% for category in itemgroup %}#}
<option value="1">From Client </option>
<option value="2">To Employee </option>
<option value="3">Against A/C Head </option>
{#{% endfor %}#}
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Receive As</label>
<div class="col-sm-8">
<select class="form-control filter_by_this add_receipt_modal_receipt_sub_type" name="receipt_sub_type" >
{#{% for category in itemgroup %}#}
<option value="1">Party Receipt</option>
<option value="2">Advance</option>
<option value="3">Loan</option>
{#{% endfor %}#}
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Amount</label>
<div class="col-sm-8">
<input type="number" name="receipt_amount" class="form-control add_receipt_modal_receipt_amount" id="receipt_amount" placeholder="Amount">
</div>
</div>
<div class="form-group filter filter-default filter-1">
<label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
<div class="col-sm-8">
{% set head_list=''|ClientList %}
{#{{ dump(head_list) }}#}
<select class="form-control add_receipt_modal_receipt_from_1 change_check_narration" name="receipt_from_1">
{% for head in head_list %}
<option value="{{ head.ClientId }}">{{ head.clientName }} ( Due: {{ head.clientDue }} )</option>
{% endfor %}
</select>
<input type="text" name="receipt_from_note_1" class="form-control add_receipt_modal_receipt_from_note_3" placeholder="Notes about this">
</div>
</div>
<div class="form-group filter filter-2">
<label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
<div class="col-sm-8">
{% set head_list='rv'|GetParentLedgerHeads %}
<select class="form-control selectize_me change_check_narration" name="receipt_from_2">
{% if head_list.CREDIT_HEADS is defined %}
{% for head in head_list.CREDIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="receipt_from_note_2" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group filter filter-3">
<label for="inputEmail3" class="col-sm-4 control-label">Receive From</label>
<div class="col-sm-8">
<select class="form-control selectize_me change_check_narration" name="receipt_from_3">
{% if head_list.CREDIT_HEADS is defined %}
{% for head in head_list.CREDIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="receipt_from_note_3" class="form-control add_receipt_modal_receipt_from_note_3" placeholder="Notes about this">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Receive On</label>
<div class="col-sm-8">
{#{% set head_list='pv'|GetParentLedgerHeads %}#}
<select class="form-control add_receipt_modal_receipt_to receipt_change_check_number" name="receipt_to">
<option value="">Select</option>
{% if head_list.DEBIT_HEADS is defined %}
{% for head in head_list.DEBIT_HEADS %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{% endif %}
</select>
<input type="text" name="receipt_from_note" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Received Amount</label>
<div class="col-sm-8">
<input type="number" name="receipt_deposit_amount" class="form-control" value="0" id="add_receipt_modal_receipt_deposit_amount" placeholder="Amount">
</div>
</div>
<div class="form-group receipt_check_number_div">
<label for="inputEmail3" class="col-sm-4 control-label">Check Number/Tx Id</label>
<div class="col-sm-8">
<input type="text" name="receipt_check_number" class="form-control" id="receipt_check_number_here" placeholder="">
<input name="check_date" type="text" class="form-control add_basic_day_picker" placeholder="Date" value="{{ ''|date('F d, Y') }}" style="">
<input type="text" name="check_narration" class="form-control" id="receipt_check_narration" placeholder="Check Narration (default)" value="">
<input type="hidden" name="check_id" class="form-control" id="receipt_check_id" placeholder="">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Bank or Other Charges Head</label>
<div class="col-sm-8">
{% set head_list='exp'|GetParentLedgerHeads %}
<select class="form-control add_receipt_modal_receipt_charge_head selectize_me" name="receipt_charge_head">
<option value="">Select</option>
{#{% if head_list.DEBIT_HEADS is defined %}#}
{% for head in head_list %}
<option value="{{ head['id'] }}">{{ head['text'] }}</option>
{% endfor %}
{#{% endif %}#}
</select>
<input type="text" name="receipt_charge_note" class="form-control" placeholder="Notes about this">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Charge Amount</label>
<div class="col-sm-8">
<input type="number" name="receipt_charge_amount" class="form-control" value="0" id="add_receipt_modal_receipt_charge_amount" placeholder="Amount">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Description</label>
<div class="col-sm-8">
<textarea name="description" rows="3" class="form-control" placeholder="Narration"></textarea>
</div>
</div>
<div class="form-group filter filter-default filter-1">
<label for="inputEmail3" class="col-sm-4 control-label"></label>
<div class="col-sm-8">
<input type="checkbox" name="auto_balance_1" value="1" id="exp_check_auto_balance" checked>
<label for="exp_check_auto_balance">Automatically Balance Invoice and Order</label>
</div>
<input type="hidden" id="AddReceiptModalSpecialType" name="AddReceiptModalSpecialType" value="">
<input type="hidden" id="AddReceiptModalSpecialTypeSoDocId" name="AddReceiptModalSpecialTypeSoDocId" value="">
<input type="hidden" id="AddReceiptModalSpecialTypeSiDocId" name="AddReceiptModalSpecialTypeSiDocId" value="">
</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">Save</button>
</div>
</div>
</form>
</div>
</div>
<script>
var add_receipt_modal_receipt_type_selector={}
var add_receipt_modal_receipt_sub_type_selector={}
var add_receipt_modal_receipt_from_1_selector={}
var add_receipt_modal_receipt_to_selector={}
// var add_receipt_modal_receipt_sub_type_selector={}
// wait for the DOM to be loaded
var SINGLE_CHECK_LIST={{ ''|GetSingleCheckList|json_encode()|raw }}
{#var HEAD_LIST={{ ''|GetParentLedgerHeads|json_encode()|raw }}#}
$(document).ready(function() {
var $add_receipt_modal_receipt_type_selector= $('.add_receipt_modal_receipt_type').selectize()
add_receipt_modal_receipt_type_selector= $add_receipt_modal_receipt_type_selector[0].selectize
var $add_receipt_modal_receipt_sub_type_selector= $('.add_receipt_modal_receipt_sub_type').selectize()
add_receipt_modal_receipt_sub_type_selector= $add_receipt_modal_receipt_sub_type_selector[0].selectize ;
var $add_receipt_modal_receipt_from_1_selector= $('.add_receipt_modal_receipt_from_1').selectize()
add_receipt_modal_receipt_from_1_selector= $add_receipt_modal_receipt_from_1_selector[0].selectize
var $add_receipt_modal_receipt_to_selector= $('.add_receipt_modal_receipt_to').selectize()
add_receipt_modal_receipt_to_selector= $add_receipt_modal_receipt_to_selector[0].selectize
var receiptOptions = {
// target: '#output1', // target element(s) to be updated with server response
// dataType: null , // 'xml', 'script', or 'json' (expected server response type)
beforeSubmit: function(arr, $form, options) {
// alertify.set({ delay: 5000 });
// alertify.alert('Please Wait..');
},
success: showResponseReceipt // post-submit callback
};
function showResponseReceipt(responseText, statusText, xhr, $form) {
if(statusText=='success') {
if(responseText.success==true) {
// alertify.closeAll();
alertify.success("Receipt Added");
if ($('.AddReceiptModalSpecialType').val() != '') {
if (typeof this_view_page !== 'undefined') {
alertify.alert('Successfully Added The Receipt. Document Name: '+responseText.docHash+'. Reloading in 2 seconds');
setTimeout(function () {
window.location.href = this_view_page;
}, 2000);
}
else
alertify.alert('Successfully Added The Receipt . Document Name: '+responseText.docHash);
}
else {
alertify.alert('Successfully Added The Receipt . Document Name: '+responseText.docHash);
}
}
else
{
// alertify.closeAll();
alertify.alert('Sorry could not Perform The action');
alertify.error("Action failed");
addCreateConfirmed = 0;
}
}
else
{
// alertify.closeAll();
alertify.alert('Sorry could not Perform The action');
alertify.error("Action failed");
addCreateConfirmed = 0;
}
// console.log(responseText)
// alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
// // console.log('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
}
$('.modalFormReceipt').ajaxForm(receiptOptions);
$('.filter').hide();
$('.filter-default').show();
$('.filter_by_this').change(function(){
// alert('here')
var filter_ind=$(this).val()
$('.filter').hide();
$('.filter-'+filter_ind).show();
})
//
//
// $('.receipt_change_check_number').change(function(){
//// alert('here')
// var filter_ind=$(this).val()
//// $('.filter').hide();
// if(SINGLE_CHECK_LIST[filter_ind]) {
// $('#receipt_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
//// alert(SINGLE_CHECK_LIST[filter_ind].id)
// $('#receipt_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
//// alert($('#check_id').val())
// $('.receipt_check_number_div').show();
// }
// else {
// $('#receipt_check_number_here').val('');
// $('#receipt_check_id').val('');
// $('.receipt_check_number_div').hide();
// }
//
// })
// $('.expense_change_check_number').change(function(){
//// alert('here')
// var filter_ind=$(this).val()
//// $('.filter').hide();
// if(SINGLE_CHECK_LIST[filter_ind]) {
// $('#expense_check_number_here').val(SINGLE_CHECK_LIST[filter_ind].name);
//// alert(SINGLE_CHECK_LIST[filter_ind].id)
// $('#expense_check_id').val(SINGLE_CHECK_LIST[filter_ind].id);
//// alert($('#check_id').val())
// $('.expense_check_number_div').show();
// }
// else {
// $('#expense_check_number_here').val('');
// $('#expense_check_id').val('');
// $('.expense_check_number_div').hide();
// }
//
// })
});
</script>