示例#1
0
文件: config.php 项目: kxr/stock3
function get_purchase_invoice_total($p_inv_id, $dbhi)
{
    if (!isset($dbhi)) {
        global $mysql_host, $mysql_user, $mysql_pass, $mysql_database;
        $dbhi = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_database);
    }
    $mysql_q = "\tSELECT SUM(uprice*qty) AS p_inv_total\n\t\t\t\t\tFROM purchase_transactions\n\t\t\t\t\tWHERE invoice_id = {$p_inv_id}\n\t\t";
    $query_res = $dbhi->query($mysql_q) or die($dbhi->error);
    $row = $query_res->fetch_assoc();
    return clean_num($row['p_inv_total']);
}
示例#2
0
文件: sale.php 项目: kxr/stock
		<tbody>
				<?php 
// Select Qurey to print the content
$res_table = mysql_query('SELECT sale_id, stock_sale.item_id, date, item_name, sale_type, invoice_no, uprice, qty, comments from stock_sale LEFT JOIN stock_items ON stock_sale.item_id=stock_items.item_id;');
while ($row = mysql_fetch_array($res_table)) {
    echo '<tr>';
    echo '<td>' . $row['sale_id'] . '</td>';
    echo '<td>' . $row['date'] . '</td>';
    //echo '<td>'.$row['item_name'].'</td>';
    echo '<td><a href="item_detail.php?iid=' . $row['item_id'] . '&p=a">' . $row['item_name'] . '</a></td>';
    echo '<td>' . $row['sale_type'] . '</td>';
    echo '<td>' . $row['invoice_no'] . '</td>';
    echo '<td>' . clean_num($row['uprice']) . ' ' . $currency . '</td>';
    echo '<td>' . clean_num($row['qty']) . '</td>';
    echo '<td>' . clean_num($row['uprice'] * $row['qty']) . '</td>';
    echo '<td><pre>' . $row['comments'] . '</pre></td>';
    echo '</tr>';
}
?>
		</tbody>
	</table>

	<div id="popupForm">
		<table width=100% cellspacing="5">
		 <form name="addform" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">		
			<tr>
				<td colspan="2" align="center" valign="center"><h2>Add Sale</h2></td>
示例#3
0
文件: hold.php 项目: kxr/stock
				<th></th>
			</tr>
		</thead>

		<tbody>
				<?php 
// Select Qurey to print the content
$res_table = mysql_query('SELECT hold_id, stock_hold.item_id, date, item_name, hold_type, qty, comments from stock_hold LEFT JOIN stock_items ON stock_hold.item_id=stock_items.item_id' . $mysql_condition);
while ($row = mysql_fetch_array($res_table)) {
    echo '<tr>';
    echo '<td>' . $row['hold_id'] . '</td>';
    echo '<td>' . $row['date'] . '</td>';
    //echo '<td>'.$row['item_name'].'</td>';
    echo '<td><a href="item_detail.php?iid=' . $row['item_id'] . '&p=a">' . $row['item_name'] . '</a></td>';
    echo '<td>' . $row['hold_type'] . '</td>';
    echo '<td>' . clean_num($row['qty']) . '</td>';
    echo '<td><pre>' . $row['comments'] . '</pre></td>';
    echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?delete=' . $row['hold_id'] . '"><img src="imgs/del.png" width="15" height="15"></img></a></td>';
    echo '</tr>';
}
?>
		</tbody>
	</table>

	<div id="popupForm">
		<table width=100% cellspacing="5">
		 <form name="addform" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">		
			<tr>
示例#4
0
    $first = 1;
    foreach ($terms as $term) {
        if ($first == 1) {
            $mysql_q = $mysql_q . " WHERE ( item_name LIKE '%{$term}%'";
        } else {
            $mysql_q = $mysql_q . " AND item_name LIKE '%{$term}%'";
        }
        $first = 0;
    }
    $mysql_q = $mysql_q . ")";
    //			$first=1;
    //			foreach ($terms as $term) {
    //			if ( $first == 1)
    //				$mysql_q = $mysql_q." OR ( group_name LIKE '%$term%'";
    //			else
    //				$mysql_q = $mysql_q." AND group_name LIKE '%$term%'";
    //			$first=0;
    //			}
    //			$mysql_q = $mysql_q.")";
}
$q_result = $dbhi->query($mysql_q);
if ($q_result->num_rows > 0) {
    while ($row = $q_result->fetch_assoc()) {
        $costprice = get_costprice($row['item_id'], $dbhi);
        $stock_info = get_stock_info($row['item_id'], $dbhi);
        $stock_num = $stock_info['total_purchase'] - $stock_info['total_sale'] - $stock_info['total_credit'];
        $data[] = array('label' => "<a>" . "#" . $row['item_id'] . " " . $row['item_name'] . "<span style='font-size:0.9em'>" . " (" . price2code($costprice) . "|" . clean_num($stock_num) . ")" . "</span>" . "<div style='font-size:0.8em'>" . $row['item_detail'] . "</div>" . "</a>", 'group' => $row['group_name'], 'detail' => $row['item_detail'], 'value' => $row['item_name'], 'id' => $row['item_id'], 'saleprice' => clean_num($row['item_saleprice']), 'costprice' => $costprice);
    }
}
echo json_encode($data);
flush();
示例#5
0
文件: purchase.php 项目: kxr/stock3
			</form>
		</thead>

		<tbody>

				<?php 
$mysql_q = "\n\t\t\t\t\t\t\t\tSELECT p_trans_id, date, item_id, vendor_id, invoice_id, uprice, qty, comments, timestamp\n\t\t\t\t\t\t\t\tFROM purchase_transactions\n\t\t\t\t\t\t\t\tORDER BY p_trans_id DESC\n\t\t\t\t\t\t\t\t";
$query_res = $dbhi->query($mysql_q);
while ($row = $query_res->fetch_assoc()) {
    $item_info = get_item_info($row['item_id'], $dbhi);
    $row_style = 'style="color:#d00000"';
    if (!empty($row['invoice_id'])) {
        $inv_no = get_vendor_invoice($row['invoice_id'], $dbhi);
        $invoice_html = "\t<a name='a_invid[]' href='javascript:;'>\n\t\t\t\t\t\t\t\t\t\t\t\t{$inv_no}\n\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='val_invid[]' value='" . $row['invoice_id'] . "' />\n\t\t\t\t\t\t\t\t\t\t\t</a>";
    } else {
        $invoice_html = "N/A";
    }
    echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $row['date'] . "</td>\n\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<a href='transactions.php?iid=" . $row['item_id'] . "'>\n\t\t\t\t\t\t\t\t\t\t" . $item_info['name'] . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<a href='vendors.php?vendorid=" . $row['vendor_id'] . "'>\n\t\t\t\t\t\t\t\t\t\t" . get_vendorname($row['vendor_id'], $dbhi) . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>{$invoice_html}</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice']) . "'>" . price2code(clean_num($row['uprice'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['qty']) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice'] * $row['qty']) . "'>" . price2code(clean_num($row['uprice'] * $row['qty'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<pre style='display:inline;'>" . $row['comments'] . "</pre>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
?>
	
		</tbody>
	</table>

</center>


<div id="v_inv_div"></div>

</body>
示例#6
0
文件: stock.php 项目: kxr/stock3
				<th>Item Name</th>
				<th>Code</th>
				<th>Stock</th>
				<th>Sale Price</th>
			</tr>
		</thead>

		<tbody id="tbodyid">
			<?php 
$mysql_q = "SELECT item_id, item_name, item_detail, item_saleprice\n\t\t\t\t\t\t\tFROM items\n\t\t\t\t\t\t\tORDER BY item_id DESC";
$query_res = $dbhi->query($mysql_q) or die($dbhi->error);
while ($row = $query_res->fetch_assoc()) {
    $i_id = $row['item_id'];
    $i_name = $row['item_name'];
    $i_detail = $row['item_detail'];
    $i_saleprice = clean_num($row['item_saleprice']);
    $stock_info = get_stock_info($i_id, $dbhi);
    $i_costprice = get_costprice($i_id, $dbhi);
    $i_costcode = price2code($i_costprice);
    $i_stocknumber = $stock_info['total_purchase'] - $stock_info['total_sale'];
    echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t#<div style='display: inline' name='iid_editable[]'>{$i_id}</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<b><a name='i_link[]' href='transactions.php?iid={$i_id}'>\n\t\t\t\t\t\t\t\t<div name='inm_disp[]'>{$i_name}</div>\n\t\t\t\t\t\t\t\t<input style='display: none' name='inm_editable[]' value='{$i_name}'/>\n\t\t\t\t\t\t\t\t<input type='hidden' name='link_space[]' value='transactions.php?iid={$i_id}'/>\n\t\t\t\t\t\t\t</a></b>\n\t\t\t\t\t\t\t<div style='font-size:0.9em'>{$i_detail}</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td title='{$i_costprice}'>\n\t\t\t\t\t\t\t{$i_costcode}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td title='" . $stock_info['total_purchase'] . "|" . $stock_info['total_sale'] . "|" . $stock_info['total_credit'] . "'>\n\t\t\t\t\t\t\t{$i_stocknumber}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t{$Currency}\n\t\t\t\t\t\t\t<div style='display: inline' id='editable_{$i_id}'>{$i_saleprice}</div>\n\t\t\t\t\t\t\t<input style='display: none' id='editbox_{$i_id}' size='4' value='{$i_saleprice}' type='text' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
}
?>
		</tbody>
	</table>


</center>

<!--
<div id="div_add_g" title="Add Group">
示例#7
0
文件: vendors.php 项目: kxr/stock3
		<tbody>
			<form name="inv_pay_form" method="post" action="<?php 
echo $_SERVER['PHP_SELF'] . "?vendorid={$vendorID}";
?>
">
			<?php 
$mysql_q = "\tSELECT p_invoice_id, date, vendor_invoice_no, invoice_note, invoice_total, payment_id\n\t\t\t\t\t\t\tFROM purchase_invoices\n\t\t\t\t\t\t\tWHERE vendor_id='{$vendorID}'\n\t\t\t\t\t\t\tORDER BY p_invoice_id DESC\n\t\t\t\t";
$query_res = $dbhi->query($mysql_q) or die($dbhi->error);
while ($row = $query_res->fetch_assoc()) {
    //If Invoice total and calculated total don't match, mention it
    $p_calc_inv_total = get_purchase_invoice_total($row['p_invoice_id'], $dbhi);
    if ($p_calc_inv_total != $row['invoice_total']) {
        $mention_calc_total = "({$p_calc_inv_total})";
    }
    echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $row['date'] . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<a name='a_veninv[]' href='javascript:;'>" . $row['vendor_invoice_no'] . "\n\t\t\t\t\t\t\t\t\t<input type='hidden' name='val_invid[]' value='" . $row['p_invoice_id'] . "' />\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t{$Currency} " . clean_num($row['invoice_total']) . "{$mention_calc_total}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t";
    //If payed get payment else display check box
    if ($row['payment_id'] > 0) {
        $m_q = "\tSELECT payment_type, ref_no\n\t\t\t\t\t\t\t\tFROM payment_out\n\t\t\t\t\t\t\t\tWHERE payment_id=" . $row['payment_id'];
        $q_r = $dbhi->query($m_q) or die($dbhi->error);
        $rw = $q_r->fetch_assoc();
        echo "\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<a name='a_payment[]' href='javascript:;'>\n\t\t\t\t\t\t\t\t\t" . $rw['payment_type'] . "# " . $rw['ref_no'] . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
    } else {
        echo "\n\t\t\t\t\t\t\t\t<td align='center'>\n\t\t\t\t\t\t\t\t\t<input type='checkbox' value='" . $row['p_invoice_id'] . "' name='invpay_check[]' />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
    }
}
?>
		</form>
		</tbody>

示例#8
0
$item_hold = 0;
while ($row = mysql_fetch_array($res_table)) {
    if ($row['transaction'] == 'Purchase') {
        $row_style = 'style="color:#d00000"';
    } else {
        $row_style = '';
    }
    echo '<tr>';
    //echo '<td '.$row_style.'>'.$row['trans_id'].'</td>';
    echo '<td ' . $row_style . '>' . $row['date'] . '</td>';
    echo '<td ' . $row_style . '>' . $row['transaction'] . '</td>';
    echo '<td ' . $row_style . '>' . $row['trans_type'] . '</td>';
    echo '<td ' . $row_style . '>' . $row['invoice_no'] . '</td>';
    echo '<td ' . $row_style . ' title="' . clean_num($row['uprice']) . '">' . price2code(clean_num($row['uprice']), $price_code) . '</td>';
    echo '<td ' . $row_style . '>' . clean_num($row['qty']) . '</td>';
    echo '<td ' . $row_style . ' title="' . clean_num($row['uprice'] * $row['qty']) . '">' . price2code(clean_num($row['uprice'] * $row['qty']), $price_code) . '</td>';
    echo '<td ' . $row_style . '><table style="padding:0px; margin:0px" width="100%" border="0"><tr><td style="border-bottom:0px; padding:0px;"><pre style="display:inline;">' . $row['comments'] . '</pre></td>';
    //if the entery is fresh, or hold type then show the delete button
    $curr_ts = time();
    $ts_diff = $curr_ts - $row['timestamp'];
    if ($ts_diff < 180 || $row['transaction'] == "Hold") {
        echo '<td style="border-bottom:0px; padding:0px;" align="right"><form style="display:inline" id="delform" name="delform" method="post"  action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '">';
        echo '<input type="hidden" name="del_tid" value="' . $row['trans_id'] . '" />';
        echo '<button style="margin:0;padding:0;" type=submit><img id="delbutton" height=8 width=8 src="imgs/del.png"></img></button>';
        echo '</form></td></tr></table></td>';
    } else {
        echo '</tr></table></td>';
    }
    echo '</tr>';
    if ($row['transaction'] == "Purchase") {
        $item_purchase += $row['qty'];
示例#9
0
文件: index.php 项目: kxr/stock
        echo '<td><a href="javascript:;" class="Tooltip">' . $lpr_arr['date'];
        echo '<span>';
        echo '<table id="TooltipTable">';
        echo '<tr><td>ID</td><td>Date</td><td>Type</td><td>Inv #</td><td>Qty</td><td>Unit Price</td><td>Comments</td></tr>';
        echo '<tr><td>' . $lpr_arr['pur_id'] . '</td><td>' . $lpr_arr['date'] . '</td><td>' . $lpr_arr['pur_type'] . '</td><td>' . $lpr_arr['invoice_no'] . '</td><td>' . clean_num($lpr_arr['qty']) . '</td><td>' . price2code(clean_num($lpr_arr['uprice'])) . '</td><td>' . $lpr_arr['comments'] . '</td></tr>';
        echo '</table>';
        echo '</span>';
        echo '</a></td>';
        //last sale
        $lsl_res = mysql_query("select * from stock_sale where item_id=\"{$_ii}\" ORDER BY date DESC LIMIT 1;");
        $lsl_arr = mysql_fetch_array($lsl_res);
        echo '<td><a href="javascript:;" class="Tooltip">' . $lsl_arr['date'];
        echo '<span>';
        echo '<table id="TooltipTable">';
        echo '<tr><td>ID</td><td>Date</td><td>Type</td><td>Inv #</td><td>Qty</td><td>Unit Price</td><td>Comments</td></tr>';
        echo '<tr><td>' . $lsl_arr['sale_id'] . '</td><td>' . $lsl_arr['date'] . '</td><td>' . $lsl_arr['sale_type'] . '</td><td>' . $lsl_arr['invoice_no'] . '</td><td>' . clean_num($lsl_arr['qty']) . '</td><td>' . price2code(clean_num($lsl_arr['uprice'])) . '</td><td>' . $lsl_arr['comments'] . '</td></tr>';
        echo '</table>';
        echo '</span>';
        echo '</a></td>';
        echo '</tr></tr></tr></tr></tr></tr></tr></tr></tbody>';
    }
}
?>
	</table>



	<div id="popupForm">
		<table width=100% cellspacing="5">
		 <form method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
示例#10
0
文件: invoice.php 项目: kxr/stock3
				<td align="right">
					<b>
						Grand Total:
						<?php 
echo "{$Currency} " . clean_num($grand_total);
?>
					</b>
					<?php 
if ($operation == 'view' && $type == 'sale') {
    echo '<br>';
    echo 'Amount Received:';
    echo "{$Currency} " . clean_num($invoice_row['amount_received']);
} elseif ($type == 'purchase' && $grand_total != $invoice_row['invoice_total']) {
    echo '<br>';
    echo 'Invoice Total:';
    echo "{$Currency} " . clean_num($invoice_row['invoice_total']);
}
?>
				</td>
			</tr>
			<?php 
if ($type == 'sale') {
    echo '
						<tr>
							<td colspan="2" style="font-size:0.8em;">
							Note: ' . $Company_SalePolicy . '
							</td>
						<tr>
					';
}
?>
示例#11
0


	<div id="s_table_container">
		<table class="blue_table_tight" border=1>
			<tr>
				<th>
					Inv#
				</th>
				<th>
					Total
				</th>
			</tr>
			<?php 
$mysql_q = "SELECT * FROM credit_invoices\n\t\t\t\t\t\t\t\tWHERE client_id='" . $_GET['cid'] . "'";
//:	WHERE date='".date('Y-m-d')."'";
$query_res = $dbhi->query($mysql_q);
while ($row = $query_res->fetch_assoc()) {
    echo "\n\t\t\t\t\t<tr id='tr_inv_" . $row['sale_invoice_id'] . "'>\n\t\t\t\t\t\t<td title='" . $row['invoice_title'] . "'>\n\t\t\t\t\t\t\t" . $row['sale_invoice_id'] . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t{$Currency} " . clean_num($row['amount_received']) . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
}
?>
		</table>
	

<div id="v_inv_div"></div>

</body>

</html>

示例#12
0
文件: sale.php 项目: kxr/stock3
				<?php 
$mysql_q = "\n\t\t\t\t\t\t\t\tSELECT sale_trans_id, date, item_id, invoice_no, uprice, qty, amount_received, comments, timestamp\n\t\t\t\t\t\t\t\tFROM sale_transactions\n\t\t\t\t\t\t\t\tORDER BY sale_trans_id DESC\n\t\t\t\t\t\t\t\t";
$query_res = $dbhi->query($mysql_q) or die($dbhi->error);
while ($row = $query_res->fetch_assoc()) {
    $item_info = get_item_info($row['item_id'], $dbhi);
    $row_style = '';
    //if amount received is diff than total (uprice*qty), then show it
    $am_rec = "";
    if (clean_num($row['uprice'] * $row['qty']) != clean_num($row['amount_received'])) {
        $am_rec = "(" . clean_num($row['amount_received']) . ")";
    }
    //if invoice is KTSS* then provide link to the invoice
    if (substr($row['invoice_no'], 0, 4) === 'KTSS') {
        $invid = substr($row['invoice_no'], 4);
        $invoice_html = "<a name='a_invid' href='javascript:;'>{$invid}</a>";
    } else {
        $invoice_html = $row['invoice_no'];
    }
    echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $row['date'] . "</td>\n\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<a href='transactions.php?iid=" . $row['item_id'] . "'>\n\t\t\t\t\t\t\t\t\t\t" . $item_info['name'] . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $invoice_html . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['uprice']) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['qty']) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['uprice'] * $row['qty']) . $am_rec . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<pre style='display:inline;'>" . $row['comments'] . "</pre>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
?>
	
		</tbody>
	</table>

</center>

<div id="v_inv_div"></div>

</body>
示例#13
0
				<?php 
$mysql_q = "\n\t\t\t\t\t\t\t\t(\tSELECT 'Sale' as SPCH, date, invoice_no as inv, uprice, qty, amount_received, comments, timestamp\n\t\t\t\t\t\t\t\t\tFROM sale_transactions\n\t\t\t\t\t\t\t\t\tWHERE item_id = {$current_itemid}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t(\tSELECT 'Purchase' as SPCH, date, invoice_id as inv, uprice, qty, null, comments, timestamp\n\t\t\t\t\t\t\t\t\tFROM purchase_transactions\n\t\t\t\t\t\t\t\t\tWHERE item_id = {$current_itemid}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tORDER BY date DESC, timestamp DESC\n\t\t\t\t\t\t\t\t";
$query_res = $dbhi->query($mysql_q);
while ($row = $query_res->fetch_assoc()) {
    if ($row['SPCH'] == 'Purchase') {
        $row_style = 'style="color:#d00000"';
    } else {
        $row_style = '';
    }
    //Display Invoice link if purchase or (sale & KTSS)
    if ($row['SPCH'] == 'Purchase' && $row['inv'] > 0) {
        $inv_td_html = '<a name="p_invid_link" href="javascript:;">' . $row['inv'] . '</a>';
    } elseif ($row['SPCH'] == 'Sale' && substr($row['inv'], 0, 4) === 'KTSS') {
        $inv_td_html = '<a name="s_invid_link" href="javascript:;">' . substr($row['inv'], 4) . '</a>';
    } else {
        $inv_td_html = $row['inv'];
    }
    echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $row['date'] . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $row['SPCH'] . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>{$inv_td_html}</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice']) . "'>" . price2code(clean_num($row['uprice'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['qty']) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice'] * $row['qty']) . "'>" . price2code(clean_num($row['uprice'] * $row['qty'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<pre style='display:inline;'>" . $row['comments'] . "</pre>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
?>
	
		</tbody>
	</table>

</center>

<div id="v_inv_div"></div>

</body>
示例#14
0
文件: edit_item.php 项目: kxr/stock3
<?php

if (!$_POST['iid'] > 0) {
    die('ERROR: Bad call. Shouldnt be called directly');
}
include_once 'config.php';
// MYSQL Connection and Database Selection
$dbhi = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_database);
if (mysqli_connect_errno()) {
    die('Could not connect to mysql: ' . mysqli_connect_errno());
}
if ($_POST['iid'] > 0 && $_POST['isp'] > 0) {
    $new_saleprice = clean_num($_POST['isp']);
    $i_id = $_POST['iid'];
    $mysql_q = "UPDATE items\n\t\t\t\t\t\tSET item_saleprice = '{$new_saleprice}'\n\t\t\t\t\t\tWHERE item_id = '{$i_id}'";
    $dbhi->query($mysql_q) or die($dbhi->error);
    echo 'UPDATED: Item SalePrice';
} elseif ($_POST['iid'] > 0 && !empty($_POST['inm'])) {
    $new_name = clean_num($_POST['inm']);
    $i_id = $_POST['iid'];
    $mysql_q = "UPDATE items\n\t\t\t\t\t\t\tSET item_name = '{$new_name}'\n\t\t\t\t\t\t\tWHERE item_id = '{$i_id}'";
    $dbhi->query($mysql_q) or die($dbhi->error);
    echo 'UPDATED: Item Name';
}
示例#15
0
文件: pos.php 项目: kxr/stock3
				</tr>
			</tfoot>
		</table>
	</form>



	<div id="s_table_container">
		<table id="inv_table" class="blue_table_tight" border=1>
			<tr>
				<th>Date</th>
				<th>Inv#</th>
				<th>Total</th>
			</tr>
			<?php 
$mysql_q = "SELECT * FROM sale_invoices";
//:	WHERE date='".date('Y-m-d')."'";
$query_res = $dbhi->query($mysql_q);
while ($row = $query_res->fetch_assoc()) {
    echo "\n\t\t\t\t\t<tr name='inv_disp_row[]'>\n\t\t\t\t\t\t<td>" . $row['date'] . "</td>\n\t\t\t\t\t\t<td name='inv_disp_id[]' title='" . $row['invoice_title'] . "'>\n\t\t\t\t\t\t\t" . $row['sale_invoice_id'] . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t{$Currency} " . clean_num($row['amount_received']) . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
}
?>
		</table>
	

<div id="v_inv_div"></div>

</body>

</html>