Document field default name

This commit is contained in:
Cüneyt Şentürk 2020-12-28 22:10:43 +03:00
parent 50eaa40327
commit 918c5af23e
5 changed files with 197 additions and 338 deletions

View File

@ -323,16 +323,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$contact_type = 'customer';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$contact_type = 'vendor'; $contact_type = 'vendor';
break; break;
default:
$contact_type = 'customer';
break;
} }
return $contact_type; return $contact_type;
@ -349,16 +347,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$issued_at = request()->get('invoiced_at', Date::now()->toDateString());
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$issued_at = request()->get('billed_at', Date::now()->toDateString()); $issued_at = request()->get('billed_at', Date::now()->toDateString());
break; break;
default:
$issued_at = request()->get('invoiced_at', Date::now()->toDateString());
break;
} }
return $issued_at; return $issued_at;
@ -375,16 +371,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$document_number = $this->getNextDocumentNumber(Document::BILL_TYPE); $document_number = $this->getNextDocumentNumber(Document::BILL_TYPE);
break; break;
default:
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
break;
} }
return $document_number; return $document_number;
@ -401,16 +395,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString();
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$due_at = request()->get('billed_at', Date::now()->toDateString()); $due_at = request()->get('billed_at', Date::now()->toDateString());
break; break;
default:
$due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString();
break;
} }
return $due_at; return $due_at;
@ -436,16 +428,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDocumentNumber = 'invoices.invoice_number';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDocumentNumber = 'bills.bill_number'; $textDocumentNumber = 'bills.bill_number';
break; break;
default:
$textDocumentNumber = 'invoices.invoice_number';
break;
} }
return $textDocumentNumber; return $textDocumentNumber;
@ -458,16 +448,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textOrderNumber = 'invoices.order_number';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textOrderNumber = 'bills.order_number'; $textOrderNumber = 'bills.order_number';
break; break;
default:
$textOrderNumber = 'invoices.order_number';
break;
} }
return $textOrderNumber; return $textOrderNumber;
@ -480,16 +468,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textIssuedAt = 'invoices.invoice_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textIssuedAt = 'bills.bill_date'; $textIssuedAt = 'bills.bill_date';
break; break;
default:
$textIssuedAt = 'invoices.invoice_date';
break;
} }
return $textIssuedAt; return $textIssuedAt;
@ -502,16 +488,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDueAt = 'invoices.due_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDueAt = 'bills.due_date'; $textDueAt = 'bills.due_date';
break; break;
default:
$textDueAt = 'invoices.due_date';
break;
} }
return $textDueAt; return $textDueAt;
@ -524,20 +508,18 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$text_items = 'general.items';
break;
default:
$text_items = setting('invoice.item_name', 'general.items'); $text_items = setting('invoice.item_name', 'general.items');
if ($text_items == 'custom') { if ($text_items == 'custom') {
$text_items = setting('invoice.item_name_input'); $text_items = setting('invoice.item_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$text_items = 'general.items';
break;
} }
return $text_items; return $text_items;
@ -550,20 +532,18 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$text_quantity = 'bills.quantity';
break;
default:
$text_quantity = setting('invoice.quantity_name', 'invoices.quantity'); $text_quantity = setting('invoice.quantity_name', 'invoices.quantity');
if ($text_quantity == 'custom') { if ($text_quantity == 'custom') {
$text_quantity = setting('invoice.quantity_name_input'); $text_quantity = setting('invoice.quantity_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$text_quantity = 'bills.quantity';
break;
} }
return $text_quantity; return $text_quantity;
@ -576,20 +556,18 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$text_price = 'bills.price';
break;
default:
$text_price = setting('invoice.price_name', 'invoices.price'); $text_price = setting('invoice.price_name', 'invoices.price');
if ($text_price == 'custom') { if ($text_price == 'custom') {
$text_price = setting('invoice.price_name_input'); $text_price = setting('invoice.price_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$text_price = 'bills.price';
break;
} }
return $text_price; return $text_price;
@ -601,16 +579,7 @@ abstract class DocumentForm extends Component
return $text_amount; return $text_amount;
} }
switch ($type) {
case 'sale':
case 'income':
case 'invoice':
case 'bill':
case 'expense':
case 'purchase':
$text_amount = 'general.amount'; $text_amount = 'general.amount';
break;
}
return $text_amount; return $text_amount;
} }
@ -633,16 +602,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideName = setting('invoice.hide_item_name', $hideName);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideName = setting('bill.hide_item_name', $hideName); $hideName = setting('bill.hide_item_name', $hideName);
break; break;
default:
$hideName = setting('invoice.hide_item_name', $hideName);
break;
} }
return $hideName; return $hideName;
@ -655,16 +622,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDescription = setting('bill.hide_item_description', $hideDescription); $hideDescription = setting('bill.hide_item_description', $hideDescription);
break; break;
default:
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
} }
return $hideDescription; return $hideDescription;
@ -677,16 +642,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideQuantity = setting('bill.hide_quantity', $hideQuantity); $hideQuantity = setting('bill.hide_quantity', $hideQuantity);
break; break;
default:
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
} }
return $hideQuantity; return $hideQuantity;
@ -699,16 +662,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hidePrice = setting('bill.hide_price', $hidePrice); $hidePrice = setting('bill.hide_price', $hidePrice);
break; break;
default:
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
} }
return $hidePrice; return $hidePrice;
@ -721,16 +682,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDiscount = setting('bill.hide_discount', $hideDiscount); $hideDiscount = setting('bill.hide_discount', $hideDiscount);
break; break;
default:
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
} }
return $hideDiscount; return $hideDiscount;
@ -743,16 +702,14 @@ abstract class DocumentForm extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideAmount = setting('bill.hide_amount', $hideAmount); $hideAmount = setting('bill.hide_amount', $hideAmount);
break; break;
default:
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
} }
return $hideAmount; return $hideAmount;

View File

@ -545,16 +545,14 @@ abstract class DocumentIndex extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textContactName = 'general.customers';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textContactName = 'general.vendors'; $textContactName = 'general.vendors';
break; break;
default:
$textContactName = 'general.customers';
break;
} }
return $textContactName; return $textContactName;
@ -593,16 +591,14 @@ abstract class DocumentIndex extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textIssueAt = 'invoices.invoice_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textIssueAt = 'bills.bill_date'; $textIssueAt = 'bills.bill_date';
break; break;
default:
$textIssueAt = 'invoices.invoice_date';
break;
} }
return $textIssueAt; return $textIssueAt;
@ -628,16 +624,14 @@ abstract class DocumentIndex extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDueAt = 'invoices.due_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDueAt = 'bills.due_date'; $textDueAt = 'bills.due_date';
break; break;
default:
$textDueAt = 'invoices.due_date';
break;
} }
return $textDueAt; return $textDueAt;
@ -663,16 +657,14 @@ abstract class DocumentIndex extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDocumentStatus = 'invoices.statuses.';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDocumentStatus = 'bills.statuses.'; $textDocumentStatus = 'bills.statuses.';
break; break;
default:
$textDocumentStatus = 'invoices.statuses.';
break;
} }
return $textDocumentStatus; return $textDocumentStatus;

View File

@ -512,16 +512,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textRecurringType = 'general.invoices';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textRecurringType = 'general.bills'; $textRecurringType = 'general.bills';
break; break;
default:
$textRecurringType = 'general.invoices';
break;
} }
return $textRecurringType; return $textRecurringType;
@ -534,16 +532,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textStatusMessage = 'invoices.messages.draft';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textStatusMessage = 'bills.messages.draft'; $textStatusMessage = 'bills.messages.draft';
break; break;
default:
$textStatusMessage = 'invoices.messages.draft';
break;
} }
return $textStatusMessage; return $textStatusMessage;
@ -629,16 +625,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textHistories = 'invoices.histories';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textHistories = 'bills.histories'; $textHistories = 'bills.histories';
break; break;
default:
$textHistories = 'invoices.histories';
break;
} }
return $textHistories; return $textHistories;
@ -651,16 +645,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textHistoryStatus = 'invoices.statuses.';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textHistoryStatus = 'bills.statuses.'; $textHistoryStatus = 'bills.statuses.';
break; break;
default:
$textHistoryStatus = 'invoices.statuses.';
break;
} }
return $textHistoryStatus; return $textHistoryStatus;
@ -1013,16 +1005,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textHeaderContact = 'general.customers';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textHeaderContact = 'general.vendors'; $textHeaderContact = 'general.vendors';
break; break;
default:
$textHeaderContact = 'general.customers';
break;
} }
return $textHeaderContact; return $textHeaderContact;
@ -1088,16 +1078,7 @@ abstract class DocumentShow extends Component
return $hideTimelineStatuses; return $hideTimelineStatuses;
} }
switch ($type) {
case 'sale':
case 'income':
case 'invoice':
case 'bill':
case 'expense':
case 'purchase':
$hideTimelineStatuses = ['paid', 'cancelled']; $hideTimelineStatuses = ['paid', 'cancelled'];
break;
}
return $hideTimelineStatuses; return $hideTimelineStatuses;
} }
@ -1127,16 +1108,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineSentTitle = 'invoices.send_invoice';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineSentTitle = 'bills.receive_bill'; $textTimelineSentTitle = 'bills.receive_bill';
break; break;
default:
$textTimelineSentTitle = 'invoices.send_invoice';
break;
} }
return $textTimelineSentTitle; return $textTimelineSentTitle;
@ -1149,16 +1128,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineSentStatusDraft = 'invoices.messages.status.send.draft';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineSentStatusDraft = 'bills.messages.status.receive.draft'; $textTimelineSentStatusDraft = 'bills.messages.status.receive.draft';
break; break;
default:
$textTimelineSentStatusDraft = 'invoices.messages.status.send.draft';
break;
} }
return $textTimelineSentStatusDraft; return $textTimelineSentStatusDraft;
@ -1171,16 +1148,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineSentStatusMarkSent = 'invoices.mark_sent';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineSentStatusMarkSent = 'bills.mark_received'; $textTimelineSentStatusMarkSent = 'bills.mark_received';
break; break;
default:
$textTimelineSentStatusMarkSent = 'invoices.mark_sent';
break;
} }
return $textTimelineSentStatusMarkSent; return $textTimelineSentStatusMarkSent;
@ -1193,16 +1168,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineSentStatusReceived = 'invoices.mark_sent';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineSentStatusReceived = 'bills.mark_received'; $textTimelineSentStatusReceived = 'bills.mark_received';
break; break;
default:
$textTimelineSentStatusReceived = 'invoices.mark_sent';
break;
} }
return $textTimelineSentStatusReceived; return $textTimelineSentStatusReceived;
@ -1215,14 +1188,12 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineSendStatusMail = 'invoices.send_mail';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineSendStatusMail = 'bills.send_mail';
break;
default:
$textTimelineSendStatusMail = 'invoices.send_mail'; $textTimelineSendStatusMail = 'invoices.send_mail';
break; break;
} }
@ -1237,16 +1208,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineGetPaidTitle = 'invoices.get_paid';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineGetPaidTitle = 'bills.make_payment'; $textTimelineGetPaidTitle = 'bills.make_payment';
break; break;
default:
$textTimelineGetPaidTitle = 'invoices.get_paid';
break;
} }
return $textTimelineGetPaidTitle; return $textTimelineGetPaidTitle;
@ -1259,16 +1228,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineGetPaidStatusAwait = 'invoices.messages.status.paid.await';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineGetPaidStatusAwait = 'bills.messages.status.paid.await'; $textTimelineGetPaidStatusAwait = 'bills.messages.status.paid.await';
break; break;
default:
$textTimelineGetPaidStatusAwait = 'invoices.messages.status.paid.await';
break;
} }
return $textTimelineGetPaidStatusAwait; return $textTimelineGetPaidStatusAwait;
@ -1292,16 +1259,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineGetPaidMarkPaid = 'invoices.mark_paid';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineGetPaidMarkPaid = 'bills.mark_paid'; $textTimelineGetPaidMarkPaid = 'bills.mark_paid';
break; break;
default:
$textTimelineGetPaidMarkPaid = 'invoices.mark_paid';
break;
} }
return $textTimelineGetPaidMarkPaid; return $textTimelineGetPaidMarkPaid;
@ -1314,16 +1279,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textTimelineGetPaidAddPayment = 'invoices.add_payment';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textTimelineGetPaidAddPayment = 'bills.add_payment'; $textTimelineGetPaidAddPayment = 'bills.add_payment';
break; break;
default:
$textTimelineGetPaidAddPayment = 'invoices.add_payment';
break;
} }
return $textTimelineGetPaidAddPayment; return $textTimelineGetPaidAddPayment;
@ -1347,16 +1310,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideName = setting('invoice.hide_item_name', $hideName);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideName = setting('bill.hide_item_name', $hideName); $hideName = setting('bill.hide_item_name', $hideName);
break; break;
default:
$hideName = setting('invoice.hide_item_name', $hideName);
break;
} }
return $hideName; return $hideName;
@ -1369,16 +1330,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDescription = setting('bill.hide_item_description', $hideDescription); $hideDescription = setting('bill.hide_item_description', $hideDescription);
break; break;
default:
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
} }
return $hideDescription; return $hideDescription;
@ -1391,16 +1350,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideQuantity = setting('bill.hide_quantity', $hideQuantity); $hideQuantity = setting('bill.hide_quantity', $hideQuantity);
break; break;
default:
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
} }
return $hideQuantity; return $hideQuantity;
@ -1413,16 +1370,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hidePrice = setting('bill.hide_price', $hidePrice); $hidePrice = setting('bill.hide_price', $hidePrice);
break; break;
default:
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
} }
return $hidePrice; return $hidePrice;
@ -1435,16 +1390,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDiscount = setting('bill.hide_discount', $hideDiscount); $hideDiscount = setting('bill.hide_discount', $hideDiscount);
break; break;
default:
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
} }
return $hideDiscount; return $hideDiscount;
@ -1457,16 +1410,14 @@ abstract class DocumentShow extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideAmount = setting('bill.hide_amount', $hideAmount); $hideAmount = setting('bill.hide_amount', $hideAmount);
break; break;
default:
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
} }
return $hideAmount; return $hideAmount;

View File

@ -146,7 +146,7 @@ abstract class DocumentTemplate extends Component
$this->hideDueAt = $hideDueAt; $this->hideDueAt = $hideDueAt;
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo); $this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
$this->textIssuedAt = $this->gettextIssuedAt($type, $textIssuedAt); $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
$this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber); $this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber);
$this->textDueAt = $this->getTextDueAt($type, $textDueAt); $this->textDueAt = $this->getTextDueAt($type, $textDueAt);
$this->textOrderNumber = $this->getTextOrderNumber($type, $textOrderNumber); $this->textOrderNumber = $this->getTextOrderNumber($type, $textOrderNumber);
@ -229,16 +229,14 @@ abstract class DocumentTemplate extends Component
$backgroundColor = '#55588b'; $backgroundColor = '#55588b';
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$backgroundColor = setting('invoice.color');
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$backgroundColor = setting('bill.color'); $backgroundColor = setting('bill.color');
break; break;
default:
$backgroundColor = setting('invoice.color');
break;
} }
return $backgroundColor; return $backgroundColor;
@ -251,16 +249,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDocumentNumber = 'invoices.invoice_number';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDocumentNumber = 'bills.bill_number'; $textDocumentNumber = 'bills.bill_number';
break; break;
default:
$textDocumentNumber = 'invoices.invoice_number';
break;
} }
return $textDocumentNumber; return $textDocumentNumber;
@ -273,16 +269,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textOrderNumber = 'invoices.order_number';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textOrderNumber = 'bills.order_number'; $textOrderNumber = 'bills.order_number';
break; break;
default:
$textOrderNumber = 'invoices.order_number';
break;
} }
return $textOrderNumber; return $textOrderNumber;
@ -295,38 +289,34 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textContactInfo = 'invoices.bill_to';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textContactInfo = 'bills.bill_from'; $textContactInfo = 'bills.bill_from';
break; break;
default:
$textContactInfo = 'invoices.bill_to';
break;
} }
return $textContactInfo; return $textContactInfo;
} }
protected function gettextIssuedAt($type, $textIssuedAt) protected function getTextIssuedAt($type, $textIssuedAt)
{ {
if (!empty($textIssuedAt)) { if (!empty($textIssuedAt)) {
return $textIssuedAt; return $textIssuedAt;
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textIssuedAt = 'invoices.invoice_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textIssuedAt = 'bills.bill_date'; $textIssuedAt = 'bills.bill_date';
break; break;
default:
$textIssuedAt = 'invoices.invoice_date';
break;
} }
return $textIssuedAt; return $textIssuedAt;
@ -339,16 +329,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$textDueAt = 'invoices.due_date';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$textDueAt = 'bills.due_date'; $textDueAt = 'bills.due_date';
break; break;
default:
$textDueAt = 'invoices.due_date';
break;
} }
return $textDueAt; return $textDueAt;
@ -361,20 +349,18 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$textItems = 'general.items';
break;
default:
$textItems = setting('invoice.item_name', 'general.items'); $textItems = setting('invoice.item_name', 'general.items');
if ($textItems == 'custom') { if ($textItems == 'custom') {
$textItems = setting('invoice.item_name_input'); $textItems = setting('invoice.item_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$textItems = 'general.items';
break;
} }
return $textItems; return $textItems;
@ -387,20 +373,18 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$textQuantity = 'bills.quantity';
break;
default:
$textQuantity = setting('invoice.quantity_name', 'invoices.quantity'); $textQuantity = setting('invoice.quantity_name', 'invoices.quantity');
if ($textQuantity == 'custom') { if ($textQuantity == 'custom') {
$textQuantity = setting('invoice.quantity_name_input'); $textQuantity = setting('invoice.quantity_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$textQuantity = 'bills.quantity';
break;
} }
return $textQuantity; return $textQuantity;
@ -413,20 +397,18 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale': case 'bill':
case 'income': case 'expense':
case 'invoice': case 'purchase':
$text_price = 'bills.price';
break;
default:
$text_price = setting('invoice.price_name', 'invoices.price'); $text_price = setting('invoice.price_name', 'invoices.price');
if ($text_price == 'custom') { if ($text_price == 'custom') {
$text_price = setting('invoice.price_name_input'); $text_price = setting('invoice.price_name_input');
} }
break; break;
case 'bill':
case 'expense':
case 'purchase':
$text_price = 'bills.price';
break;
} }
return $text_price; return $text_price;
@ -438,16 +420,7 @@ abstract class DocumentTemplate extends Component
return $textAmount; return $textAmount;
} }
switch ($type) {
case 'sale':
case 'income':
case 'invoice':
case 'bill':
case 'expense':
case 'purchase':
$textAmount = 'general.amount'; $textAmount = 'general.amount';
break;
}
return $textAmount; return $textAmount;
} }
@ -470,16 +443,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideName = setting('invoice.hide_item_name', $hideName);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideName = setting('bill.hide_item_name', $hideName); $hideName = setting('bill.hide_item_name', $hideName);
break; break;
default:
$hideName = setting('invoice.hide_item_name', $hideName);
break;
} }
return $hideName; return $hideName;
@ -492,16 +463,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDescription = setting('bill.hide_item_description', $hideDescription); $hideDescription = setting('bill.hide_item_description', $hideDescription);
break; break;
default:
$hideDescription = setting('invoice.hide_item_description', $hideDescription);
break;
} }
return $hideDescription; return $hideDescription;
@ -514,16 +483,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideQuantity = setting('bill.hide_quantity', $hideQuantity); $hideQuantity = setting('bill.hide_quantity', $hideQuantity);
break; break;
default:
$hideQuantity = setting('invoice.hide_quantity', $hideQuantity);
break;
} }
return $hideQuantity; return $hideQuantity;
@ -536,16 +503,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hidePrice = setting('bill.hide_price', $hidePrice); $hidePrice = setting('bill.hide_price', $hidePrice);
break; break;
default:
$hidePrice = setting('invoice.hide_price', $hidePrice);
break;
} }
return $hidePrice; return $hidePrice;
@ -558,16 +523,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideDiscount = setting('bill.hide_discount', $hideDiscount); $hideDiscount = setting('bill.hide_discount', $hideDiscount);
break; break;
default:
$hideDiscount = setting('invoice.hide_discount', $hideDiscount);
break;
} }
return $hideDiscount; return $hideDiscount;
@ -580,16 +543,14 @@ abstract class DocumentTemplate extends Component
} }
switch ($type) { switch ($type) {
case 'sale':
case 'income':
case 'invoice':
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
$hideAmount = setting('bill.hide_amount', $hideAmount); $hideAmount = setting('bill.hide_amount', $hideAmount);
break; break;
default:
$hideAmount = setting('invoice.hide_amount', $hideAmount);
break;
} }
return $hideAmount; return $hideAmount;

View File

@ -30,11 +30,6 @@ class Advanced extends Component
$type = ''; $type = '';
switch ($this->type) { switch ($this->type) {
case 'sale':
case 'income':
case 'invoice':
$type = 'income';
break;
case 'bill': case 'bill':
case 'expense': case 'expense':
case 'purchase': case 'purchase':
@ -49,6 +44,9 @@ class Advanced extends Component
case 'transfer': case 'transfer':
$type = 'transfer'; $type = 'transfer';
break; break;
default:
$type = 'income';
break;
} }
return $type; return $type;