| 1 | <?php |
| 2 | switch($SUBPATH[0]) { |
| 3 | default: case 1: |
| 4 | echo $this->html->form("$URL/2", 'POST', array( |
| 5 | array('margin','40','text',false,'autofocus','margin (%):'), |
| 6 | array(false,'SET-MARGIN','submit') |
| 7 | )); |
| 8 | break; |
| 9 | case 2: |
| 10 | if(isset($_POST['margin'])) { |
| 11 | $margin = 1+($_POST['margin']/100); |
| 12 | $this->db->safe_query("UPDATE model SET model_price_out = CEIL(model_price_in * $margin)"); |
| 13 | $this->post_redirect_get("$URL_INTERNAL/1", T('Margin set to').' '.($margin*100-100).'%'); |
| 14 | } |
| 15 | $this->post_redirect_get("$URL_INTERNAL/1","Set-margin: No value passed!", true); |
| 16 | break; |
| 17 | } |