function main() { global $SIDU; $conn = $SIDU['conn'][$SIDU[0]]; $link = @explode(',', $_GET['id']); echo "<form id='dataTab' name='dataTab' action='db.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}' method='post'><input type='hidden' id='objcmd' name='objcmd'/>"; @tab_tool(); //these 4 can be merged if ($link[3] == 'r') { @main_tab($SIDU, $link, $conn); } elseif ($link[3] == 'v') { @main_view($SIDU, $link, $conn); } elseif ($link[3] == 'S' && $conn[1] == 'pg') { @main_seq($SIDU, $link, $conn); } elseif ($link[3] == 'f' && $conn[1] == 'pg') { @main_func($SIDU, $link, $conn); } else { @main_db($SIDU, $link, $conn); } echo "</form><div id='DBseek' class='blobDiv' style='display:none'><div class='box'>\n", @html_img("img/tool-close.gif", "Close - Fn+F", "class='right' onclick=\"showHide('DBseek')\""), "\n<b>", @lang(1414), ":</b><br/>search table name, column name, comment, oid\n<br/>Search func name, def, comment, oid<br/>-- available in next release</div></div>"; }
function details($lot) { $sum_crdb = 0; $sum_of_fees; $item = GetOneRow("*, state.c_description as state, condi.c_description as conditio", "item inner join (select code, c_description from `condition` where type='S')state on(item.i_state=state.code) inner join (select code, c_description from `condition` where type='C')condi on(item.i_condition=condi.code)", "where lot=" . $lot); /*$fees=GetAllRows('*', 'cre_deb', "where lot=".$lot." and cd_note in('Paypal fee', 'Ebay fee', 'Ebay shipping fee','Handling fee', 'Handling loss' )");*/ $cred_db = GetAllRows('*', 'cre_deb', "where lot=" . $lot); /* $item['list_date'] $item['i_note'] $item['ebay_str_cost'] $item['case_open'] $item['repair_needed'] $item['part_of'] */ $output = "<table>\r\n\t\t<tr>\r\n\t\t<td>\r\n\t\t<table border='1'>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tLot #\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['lot'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Desciption\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['item_description'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tCurrent Condition\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['conditio'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tCurrent State\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['state'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem initial Cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['cost'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Initial Shipping cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['c_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tInitial Quanity\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['quanity'] . "\r\n\t\t\t</td>\r\n\t\t</tr>"; if ($item['quanity'] > 1) { $output .= "<tr>\r\n\t\t\t<td>\r\n\t\t\t\tQuanity Sold:\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['sold_quanity'] . "\r\n\t\t\t</td>\r\n\t\t</tr>"; } $output .= "<tr>\r\n\t\t\t<td>\r\n\t\t\t\tHas Item Sold?\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['sold']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tPrice sold @\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t\$" . $item['sold_price'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tShipping via ebay\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['s_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tActual shipping cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['actual_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Paid for\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['paid']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem in need of repair?\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['repair_needed']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>"; if ($item['part_of'] != 0) { $output .= "Part of <br />" . main_view('item.*, `condition`.c_description as descript', " inner join `condition` on code=i_state and type='S'", "lot='" . $item['part_of'] . "'", '', true); } if ($cred_db[0] != NULL) { $output .= CreDebView(true, $item['lot'], $cred_db, $sum_crdb, true); $fees = get_fees($cred_db); $handling_fee = isset($fees['Handling fee']) ? $fees['Handling fee'][0] : -1 * $fees['Handling loss'][0]; $fee_info = "<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay Sell Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Ebay fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay Shipping Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Ebay shipping fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tPaypal Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Paypal fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tHandling Fee/Debit\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $handling_fee . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tOther Credit/Debit\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . number_format($sum_crdb + ($fees['Ebay shipping fee'][0] + $fees['Paypal fee'][0] + $fees['Ebay fee'][0]) + $handling_fee * -1, 2) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; //$sum=$sum+$fees['Paypal fee'][0]+$fees['Ebay fee'][0]+$fees['Ebay shipping fee'][0]+$handling_fee; } $total = $item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']) < 0.01 ? '0.00' : $item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']); $output .= "Total Profit/Loss for lot<br />\r\n\t\t<table border='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tTotal Cost\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . ($item['cost'] + $item['c_shipping']) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay list Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $item['ebay_str_cost'] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; //$output .= $c; if (isset($fee_info)) { $output .= $fee_info; } $output .= "<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tSold price\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $item['sold_price'] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tTotal\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . number_format($item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']), 2) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</td>\r\n\t\t</tr>\r\n\t</table>"; echo $output; }