$wireFee = $invoiceInfo['bk_fee_nonus_wire']; } $balance = $invoiceInfo['mib_balance']; //+$wireFee; $full_cntry = func_get_country($invoiceInfo['bank_country'], 'co_full'); $char3_cntry = func_get_country($invoiceInfo['bank_country'], 'co_3char'); //$filename = "ETEL.".$thisdate_id.".PO.Release.cvs"; $paymentMethod = 1; if ($invoiceInfo['mib_wire_type'] == 'us') { $paymentMethod = 5; } if ($merchant[$invoiceInfo['userId']]) { $balance += $merchant[$invoiceInfo['userId']]['balance']; } //$payout.=genInvoice(&$invoiceInfo); $merchant[$invoiceInfo['userId']] = array('payout' => genInvoice(&$invoiceInfo), 'balance' => $balance); } } } foreach ($merchant as $key => $data) { if ($data['balance'] > 20) { if ($payout) { $payout .= "\n"; } $payout .= $data['payout']; } } function genInvoice($invoiceInfo) { global $thisdate_id; global $payID;
function genInvoicesForDay($order_id, $date1 = null, $prev_bill = false) { $conf = $this->BL->conf; //DATES $today = getdate(); $temp = $this->BL->recurring_data($order_id, 0, "SELECT"); $next_due_date = $temp['rec_next_date']; // Calculate what day we're generating invoices for. if (!empty($date1) && $this->utils->checkDateFormat($date1)) { // $prev_bill='U' if we're generating upcoming invoices. if (!$prev_bill && $prev_bill != 'U') { $gen_for_date = $this->utils->getXdayAfter($conf['send_before_due'], $this->utils->getDateArray($date1)); } else { $gen_for_date = $today; } } else { $gen_for_date = $this->utils->getXdayAfter($conf['send_before_due'], $today); } $v_day = date('Y-m-d', strtotime($gen_for_date['year'] . "-" . $gen_for_date['mon'] . "-" . $gen_for_date['mday'])); // Generate invoice if it is scheduled to be generated for this order if ($next_due_date == $v_day) { return genInvoice($order_id); } else { return null; } }