diff --git a/Admin/Install/db.json b/Admin/Install/db.json index ae16961..8145876 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -607,6 +607,85 @@ } } }, + "billing_bill_subscription": { + "name": "billing_bill_subscription", + "fields": { + "billing_bill_subscription_id": { + "name": "billing_bill_subscription_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "billing_bill_subscription_status": { + "name": "billing_bill_subscription_status", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_bill": { + "name": "billing_bill_subscription_bill", + "type": "INT", + "null": false, + "foreignTable": "billing_bill", + "foreignKey": "billing_bill_id" + }, + "billing_bill_subscription_start": { + "name": "billing_bill_subscription_start", + "type": "DATETIME", + "null": false + }, + "billing_bill_subscription_end": { + "name": "billing_bill_subscription_end", + "type": "DATETIME", + "null": false + }, + "billing_bill_subscription_numberofoccurrences": { + "name": "billing_bill_subscription_numberofoccurrences", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_numberofoccurrences": { + "name": "billing_bill_subscription_pattern_numberofoccurrences", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_type": { + "name": "billing_bill_subscription_pattern_type", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_pattern_interval": { + "name": "billing_bill_subscription_pattern_pattern_interval", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_dayofmonth": { + "name": "billing_bill_subscription_pattern_dayofmonth", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_daysofweek": { + "name": "billing_bill_subscription_pattern_daysofweek", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_index": { + "name": "billing_bill_subscription_pattern_index", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_month": { + "name": "billing_bill_subscription_pattern_month", + "type": "TINYINT(1)", + "null": false + }, + "billing_bill_subscription_pattern_numberofoccurrences": { + "name": "billing_bill_subscription_pattern_numberofoccurrences", + "type": "TINYINT(1)", + "null": false + }, + } + }, "billing_bill_responsible": { "name": "billing_bill_responsible", "fields": { diff --git a/Admin/Installer.php b/Admin/Installer.php index dc37901..182872a 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -60,6 +60,7 @@ final class Installer extends InstallerAbstract self::createOutgoingBillTypes($defaultTemplate); self::createIncomingBillTypes($defaultTemplate); self::createTransferBillTypes($defaultTemplate); + self::createTemplateBillTypes($defaultTemplate); } /** @@ -108,6 +109,14 @@ final class Installer extends InstallerAbstract BillTypeMapper::create()->execute($billType['invoice']); BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['invoice']->getId(), 'Rechnung', ISO639x1Enum::_DE)); + $billType['proforma_invoice'] = new BillType('Proforma Invoice'); + $billType['proforma_invoice']->numberFormat = '{y}-{id}'; + $billType['proforma_invoice']->template = new NullCollection($template); + $billType['proforma_invoice']->transferType = BillTransferType::SALES; + $billType['proforma_invoice']->transferStock = false; + BillTypeMapper::create()->execute($billType['proforma_invoice']); + BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['proforma_invoice']->getId(), 'Proforma Rechnung', ISO639x1Enum::_DE)); + $billType['credit_note'] = new BillType('Credit Note'); $billType['credit_note']->numberFormat = '{y}-{id}'; $billType['credit_note']->template = new NullCollection($template); @@ -198,6 +207,56 @@ final class Installer extends InstallerAbstract */ private static function createTransferBillTypes(int $template) : array { - return []; + $billType = []; + + $billType['stock_movement'] = new BillType('Stock Movement'); + $billType['stock_movement']->numberFormat = '{y}-{id}'; + $billType['stock_movement']->template = new NullCollection($template); + $billType['stock_movement']->transferType = BillTransferType::PURCHASE; + $billType['stock_movement']->transferStock = false; + BillTypeMapper::create()->execute($billType['stock_movement']); + BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['stock_movement']->getId(), 'Lagerumbuchung', ISO639x1Enum::_DE)); + + $billType['scrapping'] = new BillType('Scrapping'); + $billType['scrapping']->numberFormat = '{y}-{id}'; + $billType['scrapping']->template = new NullCollection($template); + $billType['scrapping']->transferType = BillTransferType::PURCHASE; + $billType['scrapping']->transferStock = false; + BillTypeMapper::create()->execute($billType['scrapping']); + BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['scrapping']->getId(), 'Verschrottung', ISO639x1Enum::_DE)); + + return $billType; + } + + /** + * Install default template bill types + * + * These bill types don't have any effect on anything, they can simply be used as templates when creating new bills. + * + * @return BillType[] + * + * @since 1.0.0 + */ + private static function createTemplateBillTypes(int $template) : array + { + $billType = []; + + $billType['subscritpion'] = new BillType('Subscription'); + $billType['subscritpion']->numberFormat = '{y}-{id}'; + $billType['subscritpion']->template = new NullCollection($template); + $billType['subscritpion']->transferType = BillTransferType::SALES; + $billType['subscritpion']->transferStock = false; + BillTypeMapper::create()->execute($billType['subscritpion']); + BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['subscritpion']->getId(), 'Abonnement', ISO639x1Enum::_DE)); + + $billType['template'] = new BillType('Template'); + $billType['template']->numberFormat = '{y}-{id}'; + $billType['template']->template = new NullCollection($template); + $billType['template']->transferType = BillTransferType::SALES; + $billType['template']->transferStock = false; + BillTypeMapper::create()->execute($billType['template']); + BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['template']->getId(), 'Vorlage', ISO639x1Enum::_DE)); + + return $billType; } }