|
@@ -68,12 +68,49 @@ class Theme_panel_biall_net extends ThemeDefault {
|
|
extract($data);
|
|
extract($data);
|
|
}
|
|
}
|
|
|
|
|
|
- $saldo = -123.456;
|
|
|
|
- $nr_konta = "123455789 TODO";
|
|
|
|
- // // USERS2_WINDYKACJA_STATUS.ACCOUNT_NUMBER
|
|
|
|
- // ACCOUNT_NUMBER = Windykacja_FunkcjeL1::bankowy_make_nrach($company['NR_RACH_MASS_PAY'], $user->ID_BILLING_USERS, 0);
|
|
|
|
- // // BILLING_OWNER.NR_RACH_MASS_PAY
|
|
|
|
|
|
+ if (!User::logged()) {
|
|
|
|
+ UI::alert('danger', "Brak dostępu");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
+ Lib::loadClass('Windykacja_StatsModel');
|
|
|
|
+ Lib::loadClass('Windykacja_FunkcjeL1');
|
|
|
|
+ $billDocs = Windykacja_StatsModel::getBillDocsByDate(User::getID());
|
|
|
|
+ $billDocs->sort_docs();
|
|
|
|
+ $billDocs->set_saldo_for_all_docs();
|
|
|
|
+ $billDocs->set_paid_status_for_all(); // Windykacja_BillingDoc._paid_status: 1 (Opłacona) | 0 (Nieopłacona)
|
|
|
|
+ $listBillDocs = $billDocs->get_docs(); // [ day => [ Windykacja_EventDoc, ... ], ... ]
|
|
|
|
+
|
|
|
|
+ $fvList = array_reduce($listBillDocs, function ($ret, $dayDocList) {
|
|
|
|
+ foreach ($dayDocList as $billDoc) {
|
|
|
|
+ if ('FVAT' == $billDoc->_type) {
|
|
|
|
+ // $nr = "Faktura Vat Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES');
|
|
|
|
+ $nr = "Nr " . $billDoc->get('NUMBER') . " / " . $billDoc->get('ID_BILLING_PREFIXES');
|
|
|
|
+ array_unshift($ret, [
|
|
|
|
+ 'NUMER FAKTURY' => $nr,
|
|
|
|
+ 'DATA WYSTAWIENIA' => $billDoc->get('BILL_DATE'),
|
|
|
|
+ 'STATUS' => ($billDoc->_paid_status) ? "Opłacona" : "Nieopłacona",
|
|
|
|
+ 'WARTOŚĆ BRUTTO' => $billDoc->get('WARTOSC'),
|
|
|
|
+ 'AKCJA' => "",
|
|
|
|
+
|
|
|
|
+ '_data' => $billDoc,
|
|
|
|
+ ]);
|
|
|
|
+ } else if ('KORV' == $billDoc->_type) {
|
|
|
|
+ // DBG::nicePrint($billDoc, "TODO: DOC KORV"); // how to print?
|
|
|
|
+ } else { // skip
|
|
|
|
+ // DBG::nicePrint($billDoc, "TODO: DOC TYPE '{$billDoc->_type}'?");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $ret;
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
|
|
+ // DBG::nicePrint($billDocs, '$billDocs');
|
|
|
|
+ // DBG::nicePrint($listBillDocs, '$listBillDocs');
|
|
|
|
+ // DBG::nicePrint($fvList, '$fvList');
|
|
|
|
+ $company = Windykacja_StatsModel::getOwnerCompany(User::getID());
|
|
|
|
+ $saldo = $billDocs->get_saldo();
|
|
|
|
+ $nr_konta = Windykacja_FunkcjeL1::bankowy_make_nrach($company['NR_RACH_MASS_PAY'], User::getID(), 0);
|
|
|
|
|
|
include dirname(__FILE__) . '/view/home.php';
|
|
include dirname(__FILE__) . '/view/home.php';
|
|
}
|
|
}
|