Example #1
0
function calculateTotal()
{
    global $total, $summary;
    $pizzaSize = $_POST["radioPizzaSize"];
    switch ($pizzaSize) {
        case "Small":
            $total += 5;
            break;
        case "Med":
            $total += 10;
            break;
        case "Large":
            $total += 15;
            break;
        case "XL":
            $total += 20;
            break;
    }
    if (isset($_POST["radioCrustType"])) {
        if ($_POST["radioCrustType"] == 'Stuffed') {
            $total += 2;
        }
    }
    $summary .= "<p class='text-left'><h3>Pizza</h3>";
    $summary .= "<dl class='text-left'>";
    $summary .= "<dt>Size</dt>";
    $summary .= "<dd>" . $pizzaSize . "</dd>";
    $summary .= "<dt>Crust Type</dt>";
    $summary .= "<dd>" . $_POST["radioCrustType"] . "</dd>";
    $summary .= "<dt>Toppings</dt>";
    $sum = sumToppings();
    $summary .= "</dl>";
    if ($sum > 0) {
        $total += $sum * 0.5;
    }
    getTaxes();
    $summary .= "</p><p><h3 class='text-danger text-right'>Your total is CAD\$" . number_format($total, 2) . "</h3></p>";
}
Example #2
0
function PostTypes()
{
    screen_icon();
    echo '<div class="wrap">';
    ?>
	<script LANGUAGE="JavaScript">
			<!--
			function confirmSubmit()
			{
			var agree=confirm("<?php 
    _e('Are you sure you wish to delete?', THEME_ADMIN_LANG_DOMAIN);
    ?>
");
			if (agree)
				return true ;
			else
				return false ;
			}
			// -->
			</script>
	<h2><?php 
    echo THEME_NAME;
    _e('Post Types and Taxonomies', THEME_ADMIN_LANG_DOMAIN);
    ?>
</h2>
	<?php 
    if (isset($_REQUEST["task"])) {
        $task = $_REQUEST["task"];
    } else {
        $task = false;
    }
    switch ($task) {
        case 'editptype':
            editpostType();
            break;
        case 'edittax':
            edittaxType();
            break;
        default:
            global $wpdb;
            $table = $wpdb->prefix . 'ultimatum_ptypes';
            $table2 = $wpdb->prefix . 'ultimatum_tax';
            if ($_POST) {
                if ($_POST[action] == 'delptype') {
                    // delete post type
                    $delete = "DELETE  FROM {$table} WHERE `name`='{$_POST['delptype']}'";
                    $r = $wpdb->query($delete);
                    $url = curPageURL();
                    //delete taxonomies of post type
                    $delete = "DELETE  FROM {$table2} WHERE `pname`='{$_POST['delptype']}'";
                    $r = $wpdb->query($delete);
                }
                if ($_POST[action] == 'delcptax') {
                    //delete tax type
                    $delete = "DELETE  FROM {$table2} WHERE `tname`='{$_POST['delcptax']}'";
                    $r = $wpdb->query($delete);
                    $url = curPageURL();
                }
                ?>
			<script language="JavaScript">
				parent.location.href='<?php 
                echo $url;
                ?>
';
			</script>
			<?php 
            }
            flush_rewrite_rules(false);
            $query = "SELECT * FROM {$table}";
            $result = $wpdb->get_results($query, ARRAY_A);
            echo '<table class="widefat">';
            echo '<thead>';
            echo '<tr><th width="150">' . __('Custom Post Type', THEME_ADMIN_LANG_DOMAIN) . '</th><th>' . __('Taxonomies', THEME_ADMIN_LANG_DOMAIN) . '</th><th style="text-align:right;" width="150"><a href="admin.php?page=wonder-types&task=editptype" class="button-primary">' . __('Add Post Type', THEME_ADMIN_LANG_DOMAIN) . '</a></th></tr>';
            echo '</thead>';
            echo '<tbody>';
            foreach ($result as $ptypes) {
                $properties = unserialize($ptypes["properties"]);
                echo '<tr>
					<td style="font-size:14px"><a href="admin.php?page=wonder-types&task=editptype&name=' . $ptypes["name"] . '">' . $properties["label"] . '</a></td>
					<td>' . getTaxes($ptypes["name"]) . '</td>
					<td align="right">
					<p><a href="admin.php?page=wonder-types&task=editptype&name=' . $ptypes["name"] . '" class="button-primary">' . __('Edit Post Type', THEME_ADMIN_LANG_DOMAIN) . '</a><br /><br /><a href="admin.php?page=wonder-types&task=edittax&name=' . $ptypes["name"] . '" class="button-primary">' . __('Add Taxonomy', THEME_ADMIN_LANG_DOMAIN) . '</a></p><form method="post" action=""><input type="hidden" name="action" value="delptype" /><input type="hidden" name="delptype" value="' . $ptypes["name"] . '" /><input type="submit" value="' . __('Delete Post Type', THEME_ADMIN_LANG_DOMAIN) . '" class="button-secondary" onClick="return confirmSubmit()" /></form></td></tr>';
            }
            echo '</tbody>';
            echo '</table>';
            break;
    }
    echo '</div>';
}
Example #3
0
* 	http://www.simpleinvoices.org
*/
#table
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$master_invoice_id = $_GET['id'];
$invoice = getInvoice($master_invoice_id);
$invoiceItems = invoice::getInvoiceItems($master_invoice_id);
//var_dump($invoiceItems);
$customers = getActiveCustomers();
$preference = getPreference($invoice['preference_id']);
$billers = getActiveBillers();
//$taxes = getActiveTaxes(); <--- look into this
$defaults = getSystemDefaults();
$taxes = getTaxes();
$preferences = getActivePreferences();
$products = getActiveProducts();
for ($i = 1; $i <= 4; $i++) {
    $customFields[$i] = show_custom_field("invoice_cf{$i}", $invoice["custom_field{$i}"], "write", '', "details_screen", '', '', '');
}
$smarty->assign("invoice", $invoice);
$smarty->assign("defaults", $defaults);
$smarty->assign("invoiceItems", $invoiceItems);
$smarty->assign("customers", $customers);
$smarty->assign("preference", $preference);
$smarty->assign("billers", $billers);
$smarty->assign("taxes", $taxes);
$smarty->assign("preferences", $preferences);
$smarty->assign("products", $products);
$smarty->assign("customFields", $customFields);
Example #4
0
function print_sales_summary_report()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $tax_id = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $orientation = $_POST['PARAM_4'];
    $destination = $_POST['PARAM_5'];
    if ($tax_id == 0) {
        $tid = _('No');
    } else {
        $tid = _('Yes');
    }
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $rep = new FrontReport(_('Sales Summary Report'), "SalesSummaryReport", user_pagesize(), 9, $orientation);
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Tax Id Only'), 'from' => $tid, 'to' => ''));
    $cols = array(0, 130, 180, 270, 350, 400, 500);
    $headers = array(_('Customer'), _('Total ex. Tax'), _('Tax'), _('Total'), _('Balance'), _('Due'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right');
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $totalnet = 0.0;
    $totaltax = 0.0;
    $transactions = getTaxTransactions($from, $to, $tax_id);
    $rep->TextCol(0, 4, _('Balances in Home Currency'));
    $rep->NewLine(2);
    $custno = 0;
    $tax = $total = 0;
    $custname = $tax_id = "";
    while ($trans = db_fetch($transactions)) {
        $customer_record = get_customer_details($custno);
        $customer_crm = getPhone($custno);
        if ($custno != $trans['debtor_no']) {
            if ($custno != 0) {
                $rep->TextCol(0, 1, $custname);
                //$rep->TextCol(1, 2,	$tax_id);
                $rep->TextCol(1, 2, $custno, $dec);
                $rep->TextCol(2, 3, $trans['debtor_no'], $dec);
                $rep->TextCol(3, 4, $customer_crm['phone'], $dec);
                $rep->AmountCol(4, 5, $tax + $total, $dec);
                $rep->AmountCol(5, 6, $customer_record["Balance"], $dec);
                $totalnet += $total;
                $totaltax += $tax;
                $total = $tax = 0;
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->NewPage();
                }
            }
            $custno = $trans['debtor_no'];
            $custname = $trans['cust_name'];
            $tax_id = $trans['tax_id'];
        }
        $taxes = getTaxes($trans['type'], $trans['trans_no']);
        if ($taxes != null) {
            if ($taxes['included_in_price']) {
                $trans['total'] -= $taxes['tax'];
            }
            $tax += $taxes['tax'];
        }
        $total += $trans['total'];
    }
    if ($custno != 0) {
        $customer_record = get_customer_details($custno);
        $rep->TextCol(0, 1, $custname);
        //$rep->TextCol(1, 2,	$tax_id);
        $rep->AmountCol(1, 2, $total, $dec);
        $rep->AmountCol(2, 3, $tax, $dec);
        $rep->AmountCol(3, 4, $tax + $total, $dec);
        $rep->AmountCol(4, 5, $customer_record["Balance"], $dec);
        $rep->AmountCol(5, 6, $customer_record["Due"], $dec);
        $totalnet += $total;
        $totaltax += $tax;
        $rep->NewLine();
    }
    $rep->Font('bold');
    $rep->NewLine();
    $rep->Line($rep->row + $rep->lineHeight);
    $rep->TextCol(0, 1, _("Total"));
    $rep->AmountCol(1, 2, $totalnet, $dec);
    $rep->AmountCol(2, 3, $totaltax, $dec);
    $rep->AmountCol(3, 4, $totaltax + $totalnet, $dec);
    $rep->Line($rep->row - 5);
    $rep->Font();
    $rep->End();
}
Example #5
0
function PostTypes(){
	echo '<div class="wrap ultwrap">';?>
	<script LANGUAGE="JavaScript">
			<!--
			function confirmSubmit()
			{
			var agree=confirm("<?php _e('Are you sure you wish to delete?', 'ultimatum');?>");
			if (agree)
				return true ;
			else
				return false ;
			}
			// -->
			</script>
	<?php
	$defpage='./admin.php?page=wonder-types';
	$task=false;
	if(isset($_GET['task'])) $task = $_GET['task'];
	
	?>
		<div class="ultadmnavi" style="position:absolute;top:0;width:100%;margin-right:25px;">
	 		<div class="navbar">
	 			<div class="navbar-inner">
	 				<a class="brand" href="<?php echo $defpage;?>"><i class="fa fa-folder-open"></i>&nbsp;<?php _e('Custom Post Types','ultimatum');?></a>
	 				<ul class="nav">
	 				<?php if(!$task):?>
		 				<li <?php if($task=="edit") echo ' class="active"' ;?>>
		 					<a href="<?php echo $defpage.'&task=editptype'; ?>"><?php _e('Create a Post Type','ultimatum');?></a>
		 				</li>
		 			<?php endif;?>
	 				</ul>
	 			</div>
	 		</div>
	 	</div>
	 	<p></p>
	 <?php 
	if(isset($_REQUEST["task"])){
		$task = $_REQUEST["task"];
	} else {
		$task=false;
	}
	switch ($task) {
		case 'editptype':
			editpostType();
		break;
		case 'edittax':
			edittaxType();
		break;
		default:
		global $wpdb;
		$table = $wpdb->prefix.ULTIMATUM_PREFIX.'_ptypes';
		$table2 = $wpdb->prefix.ULTIMATUM_PREFIX.'_tax';	
		if($_POST){
			if($_POST[action]=='delptype'){
				// delete post type
				$delete = "DELETE  FROM $table WHERE `name`='$_POST[delptype]'";
				$r = $wpdb->query($delete);
				$url = curPageURL();
				//delete taxonomies of post type
				$delete = "DELETE  FROM $table2 WHERE `pname`='$_POST[delptype]'";
				$r = $wpdb->query($delete);
			}
			if($_POST[action]=='delcptax'){
				//delete tax type
				$delete = "DELETE  FROM $table2 WHERE `tname`='$_POST[delcptax]'";
				$r = $wpdb->query($delete);
				$url = curPageURL();
			}
			?>
			<script language="JavaScript">
				parent.location.href='<?php echo $url; ?>';
			</script>
			<?php 
		}
		flush_rewrite_rules(false);
		
		$query = "SELECT * FROM $table";
		$result = $wpdb->get_results($query,ARRAY_A);
		
		echo '<table class="table table-bordered">';
		echo '<thead>';
		//<th style="text-align:right;" width="150"><a href="admin.php?page=wonder-types&task=editptype" class="button-primary">'.__('Add Post Type', 'ultimatum').'</a></td>
		echo '<tr class="info">
				<td width="150">'.__('Custom Post Type', 'ultimatum').'</td><td>'.__('Taxonomies', 'ultimatum').'</td><td></td>
				</tr>';
		echo '</thead>';
		echo '<tbody>';
		foreach ($result as $ptypes){
			$properties = unserialize($ptypes["properties"]);
			echo '<tr>
					<td style="font-size:14px"><a href="admin.php?page=wonder-types&task=editptype&name='.$ptypes["name"].'">'.$properties["label"].'</a></td>
					<td>'.getTaxes($ptypes["name"]).'</td>
					<td align="right">
		 			<form method="post" action="">
		 			<input type="hidden" name="action" value="delptype" /><input type="hidden" name="delptype" value="'.$ptypes["name"].'" />
					<div class="btn-group templateactions">
		 				<a href="admin.php?page=wonder-types&task=editptype&name='.$ptypes["name"].'" class="btn-primary btn">'.__('Edit Post Type', 'ultimatum').'</a>
	 					<a href="admin.php?page=wonder-types&task=edittax&name='.$ptypes["name"].'" class="btn-info btn">'.__('Add Taxonomy', 'ultimatum').'</a>
						<input type="submit" value="'.__('Delete Post Type', 'ultimatum').'" class="btn-danger btn" style="height:30px;" onClick="return confirmSubmit()" />
					</div>
					</form>
						</td></tr>';
		}
		echo '</tbody>';
		echo '</table>';
		break;
	}
	echo '</div>';
}
Example #6
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
$smarty->assign("taxes", getTaxes());
$smarty->assign('pageActive', 'tax_rate');
$smarty->assign('active_tab', '#setting');