Example #1
0
			</tr>
		</thead>

		<tbody>
				<?php 
// Select Qurey to print the content
$res_table = mysql_query('SELECT pur_id, stock_purchase.item_id, date, item_name, pur_type, invoice_no, uprice, qty, comments from stock_purchase LEFT JOIN stock_items ON stock_purchase.item_id=stock_items.item_id;');
while ($row = mysql_fetch_array($res_table)) {
    echo '<tr>';
    echo '<td>' . $row['pur_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['pur_type'] . '</td>';
    echo '<td>' . $row['invoice_no'] . '</td>';
    echo '<td title="' . clean_num($row['uprice']) . '">' . price2code(clean_num($row['uprice'])) . '</td>';
    //echo '<td>***</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'];
?>
Example #2
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();
Example #3
0
File: stock.php Project: kxr/stock3
				<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">
	<form method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
Example #4
0
			</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>
Example #5
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'];
Example #6
0
File: index.php Project: 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'];
Example #7
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>