Final rewriting of sales module
[fa-stable.git] / sales / manage / sales_types.php
index 15e96e10e3a975c2a83b83a4efe9cd62b90d69b4..bad18a693cd4e623082b2f422f5f57462785930f 100644 (file)
@@ -36,7 +36,7 @@ function can_process()
 
 if (isset($_POST['ADD_ITEM']) && can_process()) 
 {
-       add_sales_type($_POST['sales_type']);
+       add_sales_type($_POST['sales_type'], isset($_POST['tax_included']));
        meta_forward($_SERVER['PHP_SELF']);     
 }
 
@@ -45,7 +45,7 @@ if (isset($_POST['ADD_ITEM']) && can_process())
 if (isset($_POST['UPDATE_ITEM']) && can_process()) 
 {
 
-       update_sales_type($selected_id, $_POST['sales_type']);
+       update_sales_type($selected_id, $_POST['sales_type'], isset($_POST['tax_included']) ? 1:0);
        meta_forward($_SERVER['PHP_SELF']);     
 } 
 
@@ -91,7 +91,7 @@ $result = get_all_sales_types();
 
 start_table("$table_style width=30%");
 
-$th = array (_("Type Name"), "", "");
+$th = array (_("Type Name"), 'Tax Incl', '','');
 table_header($th);
 $k = 0;
 
@@ -99,6 +99,7 @@ while ($myrow = db_fetch($result))
 {
        alt_table_row_color($k);
        label_cell($myrow["sales_type"]);       
+       label_cell($myrow["tax_included"] ? _('Yes'):_('No'), 'align=center');  
     edit_link_cell("selected_id=".$myrow["id"]);
     delete_link_cell("selected_id=".$myrow["id"]."&delete=1");
        end_row();
@@ -111,6 +112,8 @@ end_table();
 hyperlink_no_params($_SERVER['PHP_SELF'], _("New Sales type"));
 
 start_form();
+ if (!isset($_POST['tax_included']))
+       $_POST['tax_included'] = 0;
 
 start_table("$table_style2 width=30%");
 
@@ -120,11 +123,13 @@ if ($selected_id != -1)
        $myrow = get_sales_type($selected_id);
        
        $_POST['sales_type']  = $myrow["sales_type"];
+       $_POST['tax_included']  = $myrow["tax_included"];
        
        hidden('selected_id', $selected_id);
 } 
 
 text_row_ex(_("Sales Type Name:"), 'sales_type', 20);
+check_cells("Tax  included", 'tax_included', $_POST['tax_included']);
 
 end_table(1);