788 lines
29 KiB
PHP
788 lines
29 KiB
PHP
<?php
|
|
$cv = $this->controller->view_data["custom_values"];
|
|
$data=array();
|
|
//print_r($cv);
|
|
$CustomVal = '';
|
|
$Secondary = '';
|
|
|
|
//echo $quoteid;
|
|
//echo($qid);
|
|
|
|
if($quoteid == '' && $qid != '')
|
|
{
|
|
$quo = $qid;
|
|
}
|
|
|
|
else if($qid == '' && $quoteid != '')
|
|
{
|
|
$quo = $quoteid;
|
|
}
|
|
|
|
else if($quoteid != '' || $qid != '')
|
|
{
|
|
$quo = $qid;
|
|
}
|
|
|
|
else
|
|
{
|
|
$quo = '';
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!empty($Duedate))
|
|
{
|
|
foreach ($Duedate as $Due)
|
|
{
|
|
$CustomVal = $Due->client_custom_fieldvalue;
|
|
}
|
|
}
|
|
|
|
|
|
if(!empty($GetSecondary))
|
|
{
|
|
foreach ($GetSecondary as $GetSec)
|
|
{
|
|
$Secondary = $GetSec->Secondary;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$inv_st='';
|
|
//print_r($inv_status);
|
|
|
|
foreach($inv_status as $st)
|
|
{
|
|
$inv_st= $st->invoice_status_id;
|
|
}
|
|
|
|
//echo $inv_st;
|
|
|
|
$primarystatecode='';
|
|
foreach ($GetClientPrimaryStateCode as $primary)
|
|
{
|
|
$primarystatecode=$primary->client_custom_fieldvalue;
|
|
}
|
|
|
|
$secondarystatecode='';
|
|
|
|
foreach ($GetClientSecondaryStateCode as $secondary)
|
|
{
|
|
$secondarystatecode=$secondary->client_custom_fieldvalue;
|
|
}
|
|
|
|
|
|
|
|
|
|
//print_r($fields);
|
|
// echo $secondarystatecode;
|
|
// echo $primarystatecode;
|
|
//print_r($quotes);
|
|
|
|
// echo $CustomVal ;
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
$(function () {
|
|
$('.item-task-id').each(function () {
|
|
// Disable client chaning if at least one item already has a task id assigned
|
|
if ($(this).val().length > 0) {
|
|
$('#invoice_change_client').hide();
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$('.btn_add_product').click(function () {
|
|
$('#modal-placeholder').load(
|
|
"<?php echo site_url('products/ajax/modal_product_lookups'); ?>/" + Math.floor(Math.random() * 1000)
|
|
);
|
|
});
|
|
|
|
$('.btn_add_task').click(function () {
|
|
$('#modal-placeholder').load("<?php echo site_url('tasks/ajax/modal_task_lookups/' . $invoice_id); ?>/" + Math.floor(Math.random() * 1000));
|
|
});
|
|
|
|
$('.btn_add_row').click(function () {
|
|
$('#new_row').clone().appendTo('#item_table').removeAttr('id').addClass('item').show();
|
|
});
|
|
|
|
<?php if (!$items) { ?>
|
|
$('#new_row').clone().appendTo('#item_table').removeAttr('id').addClass('item').show();
|
|
<?php } ?>
|
|
|
|
$('#btn_create_recurring').click(function () {
|
|
$('#modal-placeholder').load(
|
|
"<?php echo site_url('invoices/ajax/modal_create_recurring'); ?>",
|
|
{
|
|
invoice_id: <?php echo $invoice_id; ?>
|
|
}
|
|
);
|
|
});
|
|
|
|
$('#invoice_change_client').click(function () {
|
|
$('#modal-placeholder').load("<?php echo site_url('invoices/ajax/modal_change_client'); ?>", {
|
|
invoice_id: <?php echo $invoice_id; ?>,
|
|
client_id: "<?php echo $this->db->escape_str($invoice->client_id); ?>"
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#btn_save_invoice').click(function () {
|
|
|
|
// var custom= $('input[name^=custom],select[name^=custom]').serializeArray()
|
|
// alert(custom)
|
|
|
|
// alert(JSON.stringify(custom))
|
|
|
|
// if(valuecheck())
|
|
// {
|
|
|
|
var items = [];
|
|
//alert();
|
|
var item_order = 1;
|
|
$('table tbody.item').each(function () {
|
|
|
|
var row = {};
|
|
$(this).find('input,select,textarea').each(function () {
|
|
|
|
if ($(this).is(':checkbox')) {
|
|
row[$(this).attr('name')] = $(this).is(':checked');
|
|
} else {
|
|
row[$(this).attr('name')] = $(this).val();
|
|
}
|
|
|
|
});
|
|
|
|
row['item_order'] = item_order;
|
|
item_order++;
|
|
items.push(row);
|
|
});
|
|
|
|
|
|
var qu= $('#quoteid').val();
|
|
|
|
if(qu == "")
|
|
{
|
|
quoteid=0;
|
|
}
|
|
|
|
else
|
|
{
|
|
quoteid=qu;
|
|
}
|
|
|
|
// alert(quoteid);
|
|
// die();
|
|
|
|
$.post("<?php echo site_url('invoices/ajax/save'); ?>", {
|
|
|
|
qu:$('#quote').val(),
|
|
invoice_id: <?php echo $invoice_id; ?>,
|
|
invoice_number: $('#invoice_number').val(),
|
|
invoice_date_created: $('#invoice_date_created').val(),
|
|
invoice_date_due: $('#invoice_date_due').val(),
|
|
invoice_status_id: $('#invoice_status_id').val(),
|
|
invoice_password: $('#invoice_password').val(),
|
|
items: JSON.stringify(items),
|
|
invoice_discount_amount: $('#invoice_discount_amount').val(),
|
|
invoice_discount_percent: $('#invoice_discount_percent').val(),
|
|
invoice_terms: $('#invoice_terms').val(),
|
|
quoteid : quoteid,
|
|
custom: $('input[name^=custom],select[name^=custom]').serializeArray(),
|
|
payment_method: $('#payment_method').val()
|
|
|
|
},
|
|
|
|
function (data) {
|
|
//console.log(data);
|
|
|
|
<?php echo(IP_DEBUG ? 'console.log(data);' : ''); ?>
|
|
|
|
//console.log(data);
|
|
var response = JSON.parse(data);
|
|
|
|
|
|
if (response.success === 1) {
|
|
window.location = "<?php echo site_url('invoices/view'); ?>/" + <?php echo $invoice_id; ?>;
|
|
} else {
|
|
$('#fullpage-loader').hide();
|
|
$('.control-group').removeClass('has-error');
|
|
$('div.alert[class*="alert-"]').remove();
|
|
var resp_errors = response.validation_errors,
|
|
all_resp_errors = '';
|
|
for (var key in resp_errors) {
|
|
$('#' + key).parent().addClass('has-error');
|
|
all_resp_errors += resp_errors[key];
|
|
}
|
|
$('#invoice_form').prepend('<div class="alert alert-danger">' + all_resp_errors + '</div>');
|
|
}
|
|
});
|
|
// }
|
|
});
|
|
|
|
$('#btn_generate_pdf').click(function () {
|
|
window.open('<?php echo site_url('invoices/generate_pdf/' . $invoice_id); ?>', '_blank');
|
|
});
|
|
|
|
<?php if ($invoice->is_read_only != 1): ?>
|
|
var fixHelper = function (e, tr) {
|
|
var $originals = tr.children();
|
|
var $helper = tr.clone();
|
|
$helper.children().each(function (index) {
|
|
$(this).width($originals.eq(index).width())
|
|
});
|
|
return $helper;
|
|
};
|
|
|
|
$("#item_table").sortable({
|
|
items: 'tbody',
|
|
helper: fixHelper
|
|
});
|
|
|
|
if ($('#invoice_discount_percent').val().length > 0) {
|
|
$('#invoice_discount_amount').prop('disabled', true);
|
|
}
|
|
if ($('#invoice_discount_amount').val().length > 0) {
|
|
$('#invoice_discount_percent').prop('disabled', true);
|
|
}
|
|
|
|
$('#invoice_discount_amount').keyup(function () {
|
|
if (this.value.length > 0) {
|
|
$('#invoice_discount_percent').prop('disabled', true);
|
|
} else {
|
|
$('#invoice_discount_percent').prop('disabled', false);
|
|
}
|
|
});
|
|
$('#invoice_discount_percent').keyup(function () {
|
|
if (this.value.length > 0) {
|
|
$('#invoice_discount_amount').prop('disabled', true);
|
|
} else {
|
|
$('#invoice_discount_amount').prop('disabled', false);
|
|
}
|
|
});
|
|
<?php endif; ?>
|
|
|
|
});
|
|
</script>
|
|
|
|
<?php
|
|
echo $modal_delete_invoice;
|
|
echo $modal_add_invoice_tax;
|
|
if ($this->config->item('disable_read_only') == true) {
|
|
$invoice->is_read_only = 0;
|
|
}
|
|
?>
|
|
<style>
|
|
.form-group {
|
|
margin-bottom: -0px !important;
|
|
}
|
|
</style>
|
|
<div id="headerbar">
|
|
<h3 class="headerbar-title">
|
|
<a href="<?php echo site_url('clients/view/' . $invoice->client_id); ?>">
|
|
<?php _htmlsc(format_client($invoice)) ?>
|
|
</a>
|
|
<?php if ($invoice->invoice_status_id == 1 && !$invoice->creditinvoice_parent_id) { ?>
|
|
<span id="invoice_change_client" class="fa fa-edit cursor-pointer small"
|
|
data-toggle="tooltip" data-placement="bottom"
|
|
title="<?php _trans('change_client'); ?>"></span>
|
|
<?php } ?>
|
|
</h3>
|
|
|
|
|
|
<div class="headerbar-item pull-right <?php if ($invoice->is_read_only != 1 || $invoice->invoice_status_id != 4) { ?>btn-group<?php } ?>">
|
|
|
|
<table>
|
|
<tr>
|
|
|
|
<td style="padding-right:2%;">
|
|
|
|
<select name="invoice_status_id" id="invoice_status_id"
|
|
class="form-control btn-group btn-group-sm simple-select"
|
|
<?php if ($invoice->is_read_only == 1 && $invoice->invoice_status_id == 4) {
|
|
echo 'disabled="disabled"';
|
|
} ?>>
|
|
<?php foreach ($invoice_statuses as $key => $status) { ?>
|
|
<option value="<?php echo $key; ?>"
|
|
<?php if ($key == $invoice->invoice_status_id) { ?>selected="selected"<?php } ?>>
|
|
<?php echo $status['label']; ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</td>
|
|
<td> <div class="options btn-group btn-group-sm">
|
|
<a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#">
|
|
<i class="fa fa-caret-down no-margin"></i> <?php _trans('options'); ?>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<?php if ($invoice->is_read_only != 1) { ?>
|
|
<li>
|
|
<a href="#add-invoice-tax" data-toggle="modal">
|
|
<i class="fa fa-plus fa-margin"></i> <?php _trans('add_invoice_tax'); ?>
|
|
</a>
|
|
</li>
|
|
<?php } ?>
|
|
<li>
|
|
<a href="#" id="btn_create_credit" data-invoice-id="<?php echo $invoice_id; ?>">
|
|
<i class="fa fa-minus fa-margin"></i> <?php _trans('create_credit_invoice'); ?>
|
|
</a>
|
|
</li>
|
|
<?php if ($invoice->invoice_balance != 0) : ?>
|
|
<li>
|
|
<a href="#" class="invoice-add-payment"
|
|
data-invoice-id="<?php echo $invoice_id; ?>"
|
|
data-invoice-balance="<?php echo $invoice->invoice_balance; ?>"
|
|
data-invoice-payment-method="<?php echo $invoice->payment_method; ?>">
|
|
<i class="fa fa-credit-card fa-margin"></i>
|
|
<?php _trans('enter_payment'); ?>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
<li>
|
|
<a href="#" id="btn_generate_pdf"
|
|
data-invoice-id="<?php echo $invoice_id; ?>">
|
|
<i class="fa fa-print fa-margin"></i>
|
|
<?php _trans('download_pdf'); ?>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="<?php echo site_url('mailer/invoice/' . $invoice->invoice_id); ?>">
|
|
<i class="fa fa-send fa-margin"></i>
|
|
<?php _trans('send_email'); ?>
|
|
</a>
|
|
</li>
|
|
<li class="divider"></li>
|
|
<li>
|
|
<a href="#" id="btn_create_recurring"
|
|
data-invoice-id="<?php echo $invoice_id; ?>">
|
|
<i class="fa fa-repeat fa-margin"></i>
|
|
<?php _trans('create_recurring'); ?>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" id="btn_copy_invoice"
|
|
data-invoice-id="<?php echo $invoice_id; ?>">
|
|
<i class="fa fa-copy fa-margin"></i>
|
|
<?php _trans('copy_invoice'); ?>
|
|
</a>
|
|
</li>
|
|
<?php if ($invoice->invoice_status_id == 1 || ($this->config->item('enable_invoice_deletion') === true && $invoice->is_read_only != 1)) { ?>
|
|
<li>
|
|
<a href="#delete-invoice" data-toggle="modal">
|
|
<i class="fa fa-trash-o fa-margin"></i>
|
|
<?php _trans('delete'); ?>
|
|
</a>
|
|
</li>
|
|
<?php } ?>
|
|
</ul>
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="headerbar-item invoice-labels pull-right">
|
|
<?php if ($invoice->invoice_is_recurring) { ?>
|
|
<span class="label label-info"><?php _trans('recurring'); ?></span>
|
|
<?php } ?>
|
|
<?php if ($invoice->is_read_only == 1) { ?>
|
|
<span class="label label-danger">
|
|
<i class="fa fa-read-only"></i> <?php _trans('read_only'); ?>
|
|
</span>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
|
|
<?php echo $this->layout->load_view('layout/alerts'); ?>
|
|
|
|
<!-- <?php print_r($custom_fields)?> -->
|
|
<form id="invoice_form">
|
|
<div class="invoice">
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12 col-sm-6 col-md-5">
|
|
|
|
<div class="col-md-6" id="BillingAddress">
|
|
<div class="client-address">
|
|
<p><b>Primary Address</b></p>
|
|
<?php $this->layout->load_view('clients/partial_client_address', array('client' => $invoice)); ?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6" id='SecondayAddress' style="display:none;">
|
|
<div >
|
|
<p><b>Shipping Address</b></p>
|
|
<div class="client-address">
|
|
<?php echo $Secondary; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" id="statecode" value="" name="statecode"/>
|
|
|
|
<?php if ($custom_fields): ?>
|
|
<div class="row" id='NewAddress' style="display:none;">
|
|
<div class="col-xs-12">
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body" style="padding: 7px;">
|
|
<div class="row">
|
|
|
|
<div class="col-xs-12 col-md-4">
|
|
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 0) {
|
|
continue;
|
|
} ?>
|
|
|
|
<?php if ($custom_field->custom_field_order == 7): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php if ($custom_field->custom_field_order == 9): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php if ($custom_field->custom_field_order == 13): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<div class="col-xs-12 col-md-4">
|
|
<!-- <?php print_r($custom_fields)?> -->
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 0) {
|
|
continue;
|
|
} ?>
|
|
|
|
<?php if ($custom_field->custom_field_order == 8): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php if ($custom_field->custom_field_order == 10): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php if ($custom_field->custom_field_order == 14): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<div class="col-xs-12 col-md-4">
|
|
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 0) {
|
|
continue;
|
|
} ?>
|
|
|
|
<?php if ($custom_field->custom_field_order == 11): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php if ($custom_field->custom_field_order == 12): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php if ($custom_field->custom_field_order == 15): ?>
|
|
<?php print_field($this->mdl_invoices, $custom_field, $cv); ?>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if ($invoice->client_phone || $invoice->client_email) : ?>
|
|
<hr>
|
|
<?php endif; ?>
|
|
<?php if ($invoice->client_phone): ?>
|
|
<div>
|
|
<?php _trans('phone'); ?>:
|
|
<?php _htmlsc($invoice->client_phone); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($invoice->client_email): ?>
|
|
<div>
|
|
<?php _trans('email'); ?>:
|
|
<?php echo $invoice->client_email; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<div class="col-xs-12 visible-xs"><br></div>
|
|
|
|
<div class="col-xs-12 col-sm-5 col-md-7 ">
|
|
<div class="details-box panel panel-default panel-body" style="padding:6px;">
|
|
<div class="row">
|
|
|
|
<?php if ($invoice->invoice_sign == -1) { ?>
|
|
<div class="col-xs-12">
|
|
<div class="alert alert-warning small">
|
|
<i class="fa fa-credit-invoice"></i>
|
|
<?php
|
|
echo trans('credit_invoice_for_invoice') . ' ';
|
|
$parent_invoice_number = $this->mdl_invoices->get_parent_invoice_number($invoice->creditinvoice_parent_id);
|
|
echo anchor('/invoices/view/' . $invoice->creditinvoice_parent_id, $parent_invoice_number);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="col-xs-12 col-md-4">
|
|
|
|
<div class="invoice-properties">
|
|
|
|
<label><?php _trans('invoice'); ?> #</label>
|
|
<input type="text" id="invoice_number" class="form-control input-sm"
|
|
<?php if ($invoice->invoice_number) : ?>
|
|
value="<?php echo $invoice->invoice_number; ?>"
|
|
<?php else : ?>
|
|
placeholder="<?php _trans('not_set'); ?>"
|
|
<?php endif; ?>
|
|
<?php if ($invoice->is_read_only == 1) {
|
|
echo 'disabled="disabled"';
|
|
} ?>>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="invoice-properties has-feedback">
|
|
<label><?php _trans('date'); ?></label>
|
|
|
|
<div class="input-group">
|
|
<input name="invoice_date_created" id="invoice_date_created"
|
|
class="form-control input-sm datepicker"
|
|
value="<?php echo date_from_mysql($invoice->invoice_date_created); ?>"
|
|
<?php if ($invoice->is_read_only == 1) {
|
|
echo 'disabled="disabled"';
|
|
} ?>>
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar fa-fw"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<!-- Custom fields For Select Shipping Address-->
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 1) {
|
|
continue;
|
|
} ?>
|
|
<?php if($custom_field->custom_field_order == 0 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-xs-12 col-md-4">
|
|
<!-- Custom fields For place Of Supply , PO NO & PO Date-->
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 1) {
|
|
continue;
|
|
} ?>
|
|
<?php if($custom_field->custom_field_order == 4 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<?php if($custom_field->custom_field_order == 5 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<?php if($custom_field->custom_field_order == 6 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<div class="col-xs-12 col-md-4">
|
|
<!-- Custom fields For Select Transport Mode , Vechile NO & Driver-->
|
|
<?php foreach ($custom_fields as $custom_field): ?>
|
|
<?php if ($custom_field->custom_field_location != 1) {
|
|
continue;
|
|
} ?>
|
|
<?php if($custom_field->custom_field_order == 1){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<?php if($custom_field->custom_field_order == 2 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
<div class="col-md-6" style="padding-left:0px;">
|
|
<?php if($custom_field->custom_field_order == 3 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
</div>
|
|
<div class="col-md-6" style="padding-left:0px;padding-right:0px; ">
|
|
<?php if($custom_field->custom_field_order == 16 ){
|
|
print_field($this->mdl_invoices, $custom_field, $cv); }
|
|
?>
|
|
</div>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-xs-12 col-md-4" style="display:none">
|
|
<div class="invoice-properties has-feedback">
|
|
<label><?php _trans('due_date'); ?></label>
|
|
|
|
<div class="input-group">
|
|
<input name="invoice_date_due" id="invoice_date_due"
|
|
class="form-control input-sm datepicker"
|
|
value="<?php
|
|
|
|
$Date = $invoice->invoice_date_created;
|
|
if(strlen($CustomVal)>0)
|
|
{
|
|
echo date('d-m-Y', strtotime($Date. '+ '.trim($CustomVal).'days'));
|
|
}
|
|
else
|
|
{
|
|
echo date('d-m-Y', strtotime($Date));
|
|
}
|
|
|
|
|
|
?>"
|
|
<?php if ($invoice->is_read_only == 1) {
|
|
echo 'disabled="disabled"';
|
|
} ?>>
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar fa-fw"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" name="quoteid" id="quoteid" value="<?php echo $quo?>">
|
|
<!-- <?php print_r($data);?> -->
|
|
<div id="state" name="state"></div>
|
|
|
|
<?php $this->layout->load_view('invoices/partial_item_table',$invoice_id); ?>
|
|
|
|
|
|
</div>
|
|
|
|
</form>
|
|
<div align="right">
|
|
<?php if ($invoice->is_read_only != 1 || $invoice->invoice_status_id != 4) { ?>
|
|
<a href="#" class="btn btn-sm btn-success ajax-loader" id="btn_save_invoice">
|
|
<i class="fa fa-check"></i> <?php _trans('save'); ?>
|
|
</a>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var invst= <?php echo json_encode($inv_st, JSON_PRETTY_PRINT) ?>;
|
|
|
|
if(invst=='4')
|
|
{
|
|
$("#invoice_status_id option").attr("disabled", "disabled");
|
|
$( "#invoice_date_created" ).datepicker( "option", "disabled", true );
|
|
$("input").prop('disabled', true);
|
|
}
|
|
|
|
|
|
|
|
function myFun(a){
|
|
|
|
// var as=document.getElementById(a).value;
|
|
// console.log(as);
|
|
|
|
|
|
|
|
var pstate= <?php echo json_encode($primarystatecode, JSON_PRETTY_PRINT) ?>;
|
|
|
|
var sstate= <?php echo json_encode($secondarystatecode, JSON_PRETTY_PRINT) ?>;
|
|
|
|
// console.log(pstate);
|
|
// console.log(sstate);
|
|
var invoice_id = <?php echo json_encode($invoice_id)?>;
|
|
//alert(invoice_id);
|
|
var state = '';
|
|
if(document.getElementById(a).value=="9")
|
|
{
|
|
//alert(sstate);
|
|
document.getElementById("SecondayAddress").style.display="block";
|
|
document.getElementById("NewAddress").style.display="none";
|
|
document.getElementById("BillingAddress").style.display="none";
|
|
|
|
$('#statecode').val(sstate);
|
|
|
|
state = sstate;
|
|
|
|
}
|
|
else if(document.getElementById(a).value=="8")
|
|
{
|
|
document.getElementById("NewAddress").style.display="block";
|
|
document.getElementById("SecondayAddress").style.display="none";
|
|
document.getElementById("BillingAddress").style.display="none";
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
document.getElementById("SecondayAddress").style.display="none";
|
|
document.getElementById("NewAddress").style.display="none";
|
|
document.getElementById("BillingAddress").style.display="block";
|
|
$('#statecode').val(pstate);
|
|
|
|
var state = pstate;
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
data:{state:state,invoice_id:invoice_id},
|
|
type:"POST",
|
|
url:"<?php echo base_url();?>index.php/invoices/test",
|
|
success:function(state){
|
|
//alert(state);
|
|
}
|
|
});
|
|
|
|
// var hidstate=$('#state').val();
|
|
|
|
}
|
|
|
|
|
|
</script>
|