-$systypes_array = array (
- ST_JOURNAL => _("Journal Entry"),
- ST_BANKPAYMENT => _("Bank Payment"),
- ST_BANKDEPOSIT => _("Bank Deposit"),
- ST_BANKTRANSFER => _("Funds Transfer"),
- ST_SALESINVOICE => _("Sales Invoice"),
- ST_CUSTCREDIT => _("Customer Credit Note"),
- ST_CUSTPAYMENT => _("Customer Payment"),
- ST_CUSTDELIVERY => _("Delivery Note"),
- ST_LOCTRANSFER => _("Location Transfer"),
- ST_INVADJUST => _("Inventory Adjustment"),
- ST_PURCHORDER => _("Purchase Order"),
- ST_SUPPINVOICE => _("Supplier Invoice"),
- ST_SUPPCREDIT => _("Supplier Credit Note"),
- ST_SUPPAYMENT => _("Supplier Payment"),
- ST_SUPPRECEIVE => _("Purchase Order Delivery"),
- ST_WORKORDER => _("Work Order"),
- ST_MANUISSUE => _("Work Order Issue"),
- ST_MANURECEIVE => _("Work Order Production"),
- ST_SALESORDER => _("Sales Order"),
- ST_SALESQUOTE => _("Sales Quotation"),
- ST_COSTUPDATE => _("Cost Update"),
- ST_DIMENSION => _("Dimension")
- );
+// Don't include these defines in the $systypes_array.
+// They are used for documents only.
+define ('ST_STATEMENT', 91);
+define ('ST_CHEQUE', 92);
+
+// document inheritance
+$document_child_types = array(
+ ST_SALESQUOTE => ST_SALESORDER,
+ ST_SALESORDER => ST_CUSTDELIVERY,
+ ST_CUSTDELIVERY => ST_SALESINVOICE,
+ ST_SALESINVOICE => ST_CUSTCREDIT,
+
+ ST_PURCHORDER => ST_SUPPRECEIVE,
+ ST_SUPPRECEIVE => ST_SUPPINVOICE,
+ ST_SUPPINVOICE => ST_SUPPCREDIT,
+);
+
+function get_child_type($type)
+{
+ global $document_child_types;
+ return isset($document_child_types[$type]) ? $document_child_types[$type] : 0;
+}
+
+function get_parent_type($type)
+{
+ global $document_child_types;
+ $child = array_search($type, $document_child_types);
+ return $child ? $child : 0;
+}