/** * Static function to display form for the field type * @param string $name * @param string $value * @return html for the form containing the field */ public static function display_field($name, $value = '') { $html = ''; $do_tax_settings = new TaxSettings(); if (strlen($value) > 5) { $html .= '<table>'; $i = 1; $tax_settings = $do_tax_settings->shipping_handling_tax(); $tax_setting_names = array(); $tax_setting_values = array(); foreach ($tax_settings as $key => $val) { $tax_setting_names[] = $val["tax_name"]; $tax_setting_values[$val["tax_name"]] = $val["tax_value"]; } $used_tax_values = array(); $tax_name_value_pair = explode(',', $value); foreach ($tax_name_value_pair as $taxes) { $html .= '<tr>'; $tax_values = explode('::', $taxes); $used_tax_values[] = $tax_values[0]; $html .= ' <td style="width:90px;"> <input type="checkbox" name="' . $name . '[]" CHECKED id = "sh_tax_ft_' . $i . '" value="' . $tax_values[0] . '" onclick="show_shtax_val_ft(\'' . $i . '\')"><span style="font-size: 12px;margin-left:4px;">' . $tax_values[0] . ' ( % )</span> </td> <td style="margin-left:5px;"><span id="tax_vl_sh_ft_' . $i . '" style="display:block;"><input type="text" value="' . $tax_values[1] . '" class="form-control input-sm" name="' . $name . '_' . $i . '"></td>'; $html .= '</tr>'; $i++; } $diff = array_diff($tax_setting_names, $used_tax_values); foreach ($diff as $t_name => $t_val) { $html .= ' <td style="width:90px;"> <input type="checkbox" name="' . $name . '[]" id ="sh_tax_ft_' . $i . '" value="' . $t_val . '" onclick="show_shtax_val_ft(\'' . $i . '\')"><span style="font-size: 12px;margin-left:4px;">' . $t_val . ' ( % )</span> </td> <td style="margin-left:5px;"><span id="tax_vl_sh_ft_' . $i . '" style="display:none;"><input type="text" value="' . $tax_setting_values[$t_val] . '" class="form-control input-sm" name="' . $name . '_' . $i . '"></td>'; $html .= '</tr>'; $i++; } $html .= '</table>'; } else { $qry = "select * from shipping_handling_tax"; $do_tax_settings->query($qry); if ($do_tax_settings->getNumRows() > 0) { $html .= '<table>'; $i = 1; while ($do_tax_settings->next()) { $html .= '<tr>'; $html .= ' <td style="width:90px;"> <input type="checkbox" name="' . $name . '[]" id = "sh_tax_ft_' . $i . '" value="' . $do_tax_settings->tax_name . '" onclick="show_shtax_val_ft(\'' . $i . '\')"><span style="font-size: 12px;margin-left:4px;">' . $do_tax_settings->tax_name . ' ( % )</span> </td> <td style="margin-left:5px;"><span id="tax_vl_sh_ft_' . $i . '" style="display:none;"><input type="text" value="' . $do_tax_settings->tax_value . '" class="form-control input-sm" name="' . $name . '_' . $i . '"></td>'; $html .= '</tr>'; $i++; } $html .= '</table>'; } } $html .= "\n" . '<script>'; $html .= "\n" . 'function show_shtax_val_ft(id){ var span_id = \'tax_vl_sh_ft_\'+id; var check_box_id = \'sh_tax_ft_\'+id; if($("#"+check_box_id).is(\':checked\')){ $("#"+span_id).show(\'slow\'); }else{ $("#"+span_id).hide(\'slow\'); } }'; $html .= '</script>'; echo $html; }
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * edit view form fields section * @author Abhik Chakraborty */ $currency = $_SESSION["do_global_settings"]->get_setting_data_by_name('currency_setting'); $currency_data = json_decode($currency,true); $do_tax = new TaxSettings(); $shipping_handling_tax = $do_tax->shipping_handling_tax(); $product_service_tax = $do_tax->product_service_tax(); ?> <div class="box_content_header"> <?php echo _('Terms and condition'); ?> <hr class="form_hr"> <textarea name="terms_cond" id="terms_cond" class="expand_text_area"><?php echo $module_obj->terms_condition;?></textarea> <br /><br /> <?php if ($module_obj->terms_condition == '') {?> <br /><br /> <span style="font-size:12px;line-height:1.3;"> <input type="checkbox" id="copy_default_terms_cond"> <?php echo _('Copy default terms & condition'); }?> </span> <div style="display:none;"><textarea id="terms_cond_copy"><?php echo $tems_condition;?></textarea></div> <script> $(document.body).on('click', '#copy_default_terms_cond' ,function(e) { if ($(this).is(":checked")) { $("#terms_cond").val($("#terms_cond_copy").val());
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * Currency setting page * @author Abhik Chakraborty */ $do_tax_settings = new TaxSettings(); $product_service_tax = $do_tax_settings->product_service_tax(); $shipping_handling_tax = $do_tax_settings->shipping_handling_tax(); $currency_data = json_decode($currency, true); require_once 'view/tax_settings_view.php';