mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-24 03:20:33 +02:00
Added company and vat numbers to show in panel #105
This commit is contained in:
parent
1294c9faec
commit
3e22833450
9 changed files with 71 additions and 16 deletions
|
@ -50,7 +50,10 @@ class FinancialsController extends Controller
|
|||
$billing = $db->selectRow('SELECT * FROM registrar_contact WHERE id = ?',
|
||||
[ $invoice_details['billing_contact_id'] ]
|
||||
);
|
||||
$billing_vat = $db->selectValue('SELECT vat_number FROM registrar WHERE id = ?',
|
||||
$billing_company = $db->selectValue('SELECT companyNumber FROM registrar WHERE id = ?',
|
||||
[ $invoice_details['registrar_id'] ]
|
||||
);
|
||||
$billing_vat = $db->selectValue('SELECT vatNumber FROM registrar WHERE id = ?',
|
||||
[ $invoice_details['registrar_id'] ]
|
||||
);
|
||||
$company_name = $db->selectValue("SELECT value FROM settings WHERE name = 'company_name'");
|
||||
|
@ -60,14 +63,14 @@ class FinancialsController extends Controller
|
|||
$vat_number = $db->selectValue("SELECT value FROM settings WHERE name = 'vat_number'");
|
||||
$phone = $db->selectValue("SELECT value FROM settings WHERE name = 'phone'");
|
||||
$email = $db->selectValue("SELECT value FROM settings WHERE name = 'email'");
|
||||
|
||||
|
||||
$issueDate = new \DateTime($invoice_details['issue_date']);
|
||||
$firstDayPrevMonth = (clone $issueDate)->modify('first day of last month')->format('Y-m-d');
|
||||
$lastDayPrevMonth = (clone $issueDate)->modify('last day of last month')->format('Y-m-d');
|
||||
$statement = $db->select('SELECT * FROM statement WHERE date BETWEEN ? AND ? AND registrar_id = ?',
|
||||
[ $firstDayPrevMonth, $lastDayPrevMonth, $invoice_details['registrar_id'] ]
|
||||
);
|
||||
|
||||
|
||||
$vatCalculator = new VatCalculator();
|
||||
$vatCalculator->setBusinessCountryCode(strtoupper($cc));
|
||||
$grossPrice = $vatCalculator->calculate($invoice_details['total_amount'], strtoupper($billing['cc']));
|
||||
|
@ -86,6 +89,7 @@ class FinancialsController extends Controller
|
|||
return view($response,'admin/financials/viewInvoice.twig', [
|
||||
'invoice_details' => $invoice_details,
|
||||
'billing' => $billing,
|
||||
'billing_company' => $billing_company,
|
||||
'billing_vat' => $billing_vat,
|
||||
'statement' => $statement,
|
||||
'company_name' => $company_name,
|
||||
|
|
|
@ -58,7 +58,7 @@ class RegistrarsController extends Controller
|
|||
v::key('fax', v::optional(v::phone()), false),
|
||||
v::key('email', v::email(), true)
|
||||
];
|
||||
|
||||
|
||||
$validators = [
|
||||
'name' => v::stringType()->notEmpty()->length(1, 255),
|
||||
'ianaId' => v::optional(v::positive()->length(1, 5)),
|
||||
|
@ -75,6 +75,8 @@ class RegistrarsController extends Controller
|
|||
'creditLimit' => v::numericVal(),
|
||||
'creditThreshold' => v::numericVal(),
|
||||
'thresholdType' => v::in(['fixed', 'percent']),
|
||||
'companyNumber' => v::positive()->length(1, 30),
|
||||
'vatNumber' => v::optional(v::length(1, 30)),
|
||||
'ipAddress' => v::optional($ipAddressValidator),
|
||||
'user_name' => v::stringType()->notEmpty()->length(1, 255),
|
||||
'user_email' => v::email(),
|
||||
|
@ -122,6 +124,9 @@ class RegistrarsController extends Controller
|
|||
if (empty($data['ianaId']) || !is_numeric($data['ianaId'])) {
|
||||
$data['ianaId'] = null;
|
||||
}
|
||||
if (empty($data['vatNumber'])) {
|
||||
$data['vatNumber'] = null;
|
||||
}
|
||||
|
||||
$db->insert(
|
||||
'registrar',
|
||||
|
@ -141,6 +146,8 @@ class RegistrarsController extends Controller
|
|||
'creditLimit' => $data['creditLimit'],
|
||||
'creditThreshold' => $data['creditThreshold'],
|
||||
'thresholdType' => $data['thresholdType'],
|
||||
'companyNumber' => $data['companyNumber'],
|
||||
'vatNumber' => $data['vatNumber'],
|
||||
'currency' => $currency,
|
||||
'crdate' => $crdate,
|
||||
'lastupdate' => $crdate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue