public function check_ledger_code() { $this->verify_nonce('erp-ac-nonce'); $code = isset($_POST['code']) ? intval($_POST['code']) : ''; if (Model\Ledger::code($code)->get()->first() === null) { $this->send_success(); } $this->send_error(); }
foreach ($plotdata as $key => $data) { if (!isset($data['journals'])) { continue; } foreach ($data['journals'] as $jouranal_key => $journal) { $ledgers[$journal['ledger_id']][] = $journal['credit']; // $ledger = \WeDevs\ERP\Accounting\Model\Ledger::find( $journal['ledger_id'] ); // if ( array_key_exists( $journal['ledger_id'], $amount ) ) { // } // $amount[$journal['ledger_id']] = array( $key, $journal['credit'] ); // $label[$journal['ledger_id']] = array( $key, $ledger->name ); } } foreach ($ledgers as $ledger_id => $ledger_amount) { $amounts[] = array_sum($ledger_amount); $ledger = \WeDevs\ERP\Accounting\Model\Ledger::find($ledger_id); $labels[] = $ledger->name; } foreach ($amounts as $key => $amount_val) { $amount[] = array($key, $amount_val); $label[] = array($key, $labels[$key]); } $amount = json_encode($amount); $label = json_encode($label); //var_dump( $amount, $label ); die(); ?> <script type="text/javascript"> jQuery(document).ready(function ($) {