diff --git a/Admin/Install/Media.install.json b/Admin/Install/Media.install.json new file mode 100644 index 0000000..ba3947a --- /dev/null +++ b/Admin/Install/Media.install.json @@ -0,0 +1,31 @@ +[ + { + "type": "collection", + "name": "Billing", + "virtualPath": "/Modules", + "user": 1 + }, + { + "type": "collection", + "name": "Templates", + "virtualPath": "/Modules/Billing", + "user": 1 + }, + { + "type": "collection", + "name": "Bills", + "virtualPath": "/Modules/Billing", + "user": 1 + }, + { + "type": "upload", + "create_collection": true, + "name": "Default", + "virtualPath": "/Modules/Billing/Templates", + "path": "/Modules/Media/Files/Modules/Billing/Templates/Default", + "files": [ + "/Modules/Billing/Admin/Install/Media" + ], + "user": 1 + } +] \ No newline at end of file diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php new file mode 100644 index 0000000..c4f4b30 --- /dev/null +++ b/Admin/Install/Media.php @@ -0,0 +1,43 @@ + __DIR__ . '/Media.install.json']); + } +} diff --git a/Admin/Install/Media/bill.pdf.php b/Admin/Install/Media/bill.pdf.php new file mode 100644 index 0000000..b4994de --- /dev/null +++ b/Admin/Install/Media/bill.pdf.php @@ -0,0 +1,287 @@ +getData('bill'); + +$mpdf = new Mpdf([ + 'mode' => 'utf-8', + 'format' => 'A4-L', + 'orientation' => 'L', + 'margin_left' => 0, + 'margin_right' => 0, + 'margin_top' => 0, + 'margin_bottom' => 0, + 'margin_header' => 0, + 'margin_footer' => 0, +]); + +$mpdf->SetDisplayMode('fullpage'); +$mpdf->SetTitle($bill->getNumber()); +$mpdf->SetAuthor('Orange Management'); + +$mpdf->AddPage(); + +$mpdf->SetHTMLHeader(' +'); + +$mpdf->SetHTMLFooter(' +'); + +$mpdf->WriteHTML(' + + + + + + +
Date: 13th November 2008
+ + + + +
SOLD TO:

345 Anotherstreet
Little Village
Their City
CB22 6SO
 SHIP TO:

345 Anotherstreet
Little Village
Their City
CB22 6SO
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ref. No.QuantityDescriptionUnit PriceAmount
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
MF123456710Large pack Hoover bags£2.56£25.60
MX378019821Womans waterproof jacket
Options - Red and charcoal.
£102.11£102.11
MR700929825Steel nails; oval head; 30mm x 3mm. Packs of 1000.£12.26£325.60
Subtotal:£1825.60
Tax:£18.25
Shipping:£42.56
TOTAL:£1882.56
Deposit:£100.00
Balance due:£1782.56
+
Payment terms: payment due in 30 days
+ + +'); + +$mpdf->Output(); diff --git a/Admin/Install/Media/logo.png b/Admin/Install/Media/logo.png new file mode 100755 index 0000000..27d7f3c Binary files /dev/null and b/Admin/Install/Media/logo.png differ diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 0b2a35c..655bb63 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -41,7 +41,7 @@ use phpOMS\Model\Message\FormValidation; final class ApiController extends Controller { /** - * Api method to create a wiki entry + * Api method to create a bill * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -68,7 +68,7 @@ final class ApiController extends Controller } /** - * Method to create a wiki entry from request. + * Method to create a bill from request. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -96,7 +96,7 @@ final class ApiController extends Controller } /** - * Method to validate wiki entry creation from request + * Method to validate bill creation from request * * @param RequestAbstract $request Request * @@ -121,7 +121,7 @@ final class ApiController extends Controller } /** - * Api method to create a wiki entry + * Api method to create a bill element * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -153,7 +153,7 @@ final class ApiController extends Controller } /** - * Method to create a wiki entry from request. + * Method to create a bill element from request. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -197,7 +197,7 @@ final class ApiController extends Controller } /** - * Method to create a wiki entry from request. + * Method to update a bill because of a changed bill element (add, remove, change) from request. * * @param Bill $bill Bill * @param BillElement $element Bill element @@ -218,7 +218,7 @@ final class ApiController extends Controller } /** - * Method to validate wiki entry creation from request + * Method to validate bill element creation from request * * @param RequestAbstract $request Request * @@ -236,4 +236,44 @@ final class ApiController extends Controller return []; } + + /** + * Api method to create and archive a bill + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return void + * + * @api + * + * @since 1.0.0 + */ + public function apiBillPdfArchiveCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + { + $this->apiBillPdfCreate($request, $response, $data); + // upload pdf to media module + } + + /** + * Api method to create a bill + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return void + * + * @api + * + * @since 1.0.0 + */ + public function apiBillPdfCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + { + $bill = BillMapper::get($request->getData('id')); + + // get default template from database OR get template based on provided request template id + // create pdf based on template + } } diff --git a/info.json b/info.json index 06dc5ef..3e81af5 100644 --- a/info.json +++ b/info.json @@ -22,7 +22,8 @@ "ClientManagement": "1.0.0" }, "providing": { - "Navigation": "*" + "Navigation": "*", + "Media": "*" }, "load": [ {