/**
  * event function to add the invoice payment 
  * @param object $evctl
  */
 public function eventAjaxAddInvoicePayment(EventControler $evctl)
 {
     $err = false;
     $error_code = 0;
     if (trim($evctl->payment_date) == '') {
         $err = true;
         $error_code = 1;
     } elseif (trim($evctl->ref_num) == '') {
         $err = true;
         $error_code = 2;
     } elseif ((int) FieldType30::convert_before_save(trim($evctl->amount)) == 0) {
         $err = true;
         $error_code = 3;
     } elseif (true === $this->is_payment_more_than_due($evctl->idinvoice, FieldType30::convert_before_save(trim($evctl->amount)))) {
         $err = true;
         $error_code = 4;
     }
     if (true === $err) {
         echo $error_code;
     } else {
         $payment_date = FieldType9::convert_before_save($evctl->payment_date);
         $payment_mode = $evctl->payment_mode;
         $amount = FieldType30::convert_before_save($evctl->amount);
         $ref_num = CommonUtils::purify_input($evctl->ref_num);
         $additional_note = CommonUtils::purify_input($evctl->additional_note);
         $idinvoice = (int) $evctl->idinvoice;
         // add to paymentlog
         $do_paymentlog = new Paymentlog();
         $do_paymentlog->addNew();
         $do_paymentlog->date_added = $payment_date;
         $do_paymentlog->amount = $amount;
         $do_paymentlog->ref_num = $ref_num;
         $do_paymentlog->idpayment_mode = $payment_mode;
         $do_paymentlog->add();
         $idpaymentlog = $do_paymentlog->getInsertId();
         // add to invoice payment
         $this->addNew();
         $this->idinvoice = $idinvoice;
         $this->idpaymentlog = $idpaymentlog;
         $this->additional_note = $additional_note;
         $this->iduser = $_SESSION["do_user"]->iduser;
         $this->add();
         $qry = "\n\t\t\tselect * from `payment_mode` where `idpayment_mode` = ?\n\t\t\t";
         $stmt = $this->getDbConnection()->executeQuery($qry, array($evctl->payment_mode));
         $data = $stmt->fetch();
         $payment_mode_name = $data['mode_name'];
         $html = '';
         $html .= '<tr>';
         $html .= '<td>' . FieldType9::display_value($payment_date) . '</td>';
         $html .= '<td>' . FieldType30::display_value($amount) . '</td>';
         $html .= '<td>' . FieldType1::display_value($ref_num) . '</td>';
         $html .= '<td>' . FieldType1::display_value($payment_mode_name) . '</td>';
         $html .= '<td>' . _('charge') . '</td>';
         $html .= '<td>' . nl2br($additional_note) . '</td>';
         $html .= '</tr>';
         $invoice_payments = new InvoicePayments();
         $due_amount = FieldType30::display_value($invoice_payments->get_due_amount($idinvoice));
         echo json_encode(array('html' => $html, 'due_amount' => $due_amount));
     }
 }
echo _('Mode');
?>
</th>
				<th width="15%"><?php 
echo _('Transaction Type');
?>
</th> 
				<th width="30%"><?php 
echo _('Note');
?>
</th>
			</tr> 
		</thead>
		<tbody id="payment_details_tbody">
		<?php 
if (count($payments) > 0) {
    foreach ($payments as $key => $val) {
        echo '<tr>';
        echo '<td>' . FieldType9::display_value($val['date_added']) . '</td>';
        echo '<td>' . FieldType30::display_value($val['amount']) . '</td>';
        echo '<td>' . FieldType1::display_value($val['ref_num']) . '</td>';
        echo '<td>' . FieldType1::display_value($val['mode_name']) . '</td>';
        echo '<td>' . FieldType1::display_value($val['transaction_type']) . '</td>';
        echo '<td>' . nl2br($val['additional_note']) . '</td>';
        echo '</tr>';
    }
}
?>
		</tbody>
	</table>
</div>
Example #3
0
?>
				</div>
			</div>
			<br />
			<div class="row">
				<div class="col-xs-4">
					<label class="control-label" for="ref_num"><?php 
echo _('Ref Number');
?>
</label>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
					<?php 
echo FieldType1::display_field('ref_num');
?>
				</div>
			</div>
			<br />
			<div class="row">
				<div class="col-xs-4">
					<label class="control-label" for="ref_num"><?php 
echo _('Additional Note');
?>
</label>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-8">
					<?php 
Example #4
0
    echo _('Save');
    ?>
"/>
	</div>
</form>
<?php 
} else {
    echo '<form class="form-horizontal" id="HelloWorld__eventSampleHelloWorld_2" name="HelloWorld__eventSampleHelloWorld_2"  method="post">';
    ?>
	<label class="control-label" for="sample_text_2"><?php 
    echo _('Add some text');
    ?>
</label>
	<div class="controls">
	<?php 
    echo FieldType1::display_field('sample_text_2');
    ?>
	</div>
	<hr class="form_hr">
	<div id="sample_submit_area_2">
		<input type="submit" class="btn btn-primary" id="sample_submit_button" value="<?php 
    echo _('Save');
    ?>
"/>
	</div>
</form>
<?php 
}
?>

<script type="text/javascript">