</table> <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="cart_listingtbl2"> <tr > <th width="5%" class="radius_left">#</th> <th width="15%" align="center">Order Id </th> <th width="22%" align="left" >Date Added (mm/dd/yyyy)</th> <th width="17%" align="left" >Order Total</th> <th width="18%" align="center">Status</th> <th width="18%" class="radius_right">Action</th> </tr> <?php if (mysql_num_rows($result) > 0) { $i = 1; while ($row = mysql_fetch_array($result)) { $currencySymbol = getCurrencySybol($row['vorder_currency']); $link = "<a href='vieworder.php?orderid=" . $row["order_id"] . "'>"; $check = "<input type='checkbox' name='chkproducts[]' value='" . $row["product_id"] . "' > "; // added for including the shipping total $totalshippingcost = 0; /*$select_shipping_cost = "SELECT sd.vshipping_name, sd.nshipping_cost,od.product_name FROM ".$tableprefix."shipping_details sd,".$tableprefix."order_details od WHERE od.product_id=sd.nshp_productid AND norder_id = ".$row['order_id']." AND nshp_status = 'C' AND od.artist_id = '".addslashes($row['artist_id'])."' GROUP BY sd.nshp_productid order by od.product_name"; $result_shipping_cost = mysql_query($select_shipping_cost); if(mysql_num_rows($result_shipping_cost) > 0) {
} else { $message = "<br>Please correct the following errors to continue!<br>" . $message; } } if (isset($_GET["msg"]) and $_GET["msg"] != "") { $msg = $_GET["msg"]; switch ($msg) { case "deleted": $message = MSG_USER_DELETED; break; default: } // switch } $currencycode = getSellerCurrencySybol($artistid); $currencySymbol = getCurrencySybol($currencycode); /*---------Multicart 2.0 Upgradation---------*/ $hide_shipping_display = 0; $select_order = "SELECT prd.product_id \n FROM " . $tableprefix . "products prd," . $tableprefix . "orders ord," . $tableprefix . "order_details ord_det\n WHERE ord.order_id = ord_det.order_id\n AND ord_det.product_id = prd.product_id\n AND prd.vdigital_product = 'Y'\n AND ord.order_id = " . $orderid; $result_order = mysql_query($select_order) or die(mysql_error()); if (mysql_num_rows($result_order) > 0) { $hide_shipping_display = 1; } $sellerCurrency = getSellerCurrencySybol($artistid); $select_order_gift = "SELECT prd.product_id \n FROM " . $tableprefix . "products prd," . $tableprefix . "orders ord," . $tableprefix . "order_details ord_det," . $tableprefix . "categories cat\n WHERE ord.order_id = ord_det.order_id\n AND ord_det.product_id = prd.product_id\n AND prd.product_category = cat.category_id\n AND cat.gift_certificate_flag = 'Y'\n AND ord.order_id = " . $orderid; $result_order_gift = mysql_query($select_order_gift) or die(mysql_error()); if (mysql_num_rows($result_order_gift) > 0) { $hide_shipping_display = 1; } /*---------Multicart 2.0 Upgradation---------*/ //$qryopt1 .= " AND o.vorder_currency = cm.vcurrency_code ";
function exportCSV($artistid) { global $tableprefix; $adminCurrency = GetAdminCurrency(); $currencycode = getSellerCurrencySybol($artistid); $currencySymbol = getCurrencySybol($currencycode); $csv = new CSV(array('Order #', 'Order Total', 'Commission (%)', 'Total Tax Amount', 'Total Shipping Amount', 'Product Total Amount', 'Amount Received [ Product Total Amount - Admin Commision + Product Shipping + Tax ]', 'Date Paid(mm/dd/yyyy)', 'Payment Status'), ";"); $qryopt = ""; $qrybtw = ""; $sql = " SELECT sp.*,s.artist_name FROM " . $tableprefix . "artist_payments sp\n\t\tINNER JOIN " . $tableprefix . "artists s ON sp.artist_id = s.artist_id\n INNER JOIN " . $tableprefix . "orders o ON o.order_id = sp.order_id" . $qryopt . "\n\t\tWHERE sp.artist_id = '" . addslashes($artistid) . "' AND o.vpayment_status='C'" . $qrybtw . "order by sp.artist_payment_id DESC "; $rs = mysql_query($sql) or die("qqqq" . mysql_error()); $result = mysql_query($sql) or die("www" . mysql_error()); if (mysql_num_rows($result) > 0) { $i = 1; $total = 0; while ($row = mysql_fetch_array($rs)) { $txtPaymentDate = isNotNull($row["payment_date"] and $row["payment_date"] != "0000-00-00") ? dateFormat($row["payment_date"], "Y-m-d", "m/d/Y") : " Not Yet Settled;"; if ($row['payment_status'] == 'P') { $Paymentstatus = 'Pending'; } else { $Paymentstatus = 'Paid'; } $qryopt1 = " "; $taxtotal = 0; $sql1 = "SELECT o.*, u.user_name, u.email, od.product_discount,sum( (od.product_price-(od.product_price*product_discount/100)) * od.product_quantity) as total,sum(od.product_tax)as taxtotal\n\t\tFROM " . $tableprefix . "orders o\n\t\tINNER JOIN " . $tableprefix . "users u ON o.user_id = u.user_id\n\t\tINNER JOIN " . $tableprefix . "order_details od ON o.order_id = od.order_id\n\t\tWHERE od.artist_id = '" . $artistid . "'\n AND o.order_id = " . $row['order_id'] . "\n\t\tAND o.vpayment_status != 'P'" . $qryopt1 . " GROUP BY o.order_id ORDER BY o.order_date,o.order_id DESC "; $sellerCurrency = getSellerCurrencySybol($artistid); $result1 = mysql_query($sql1); if (mysql_num_rows($result1) != 0) { $row1 = mysql_fetch_array($result1); $ordernumber = $row1["order_id"]; $username = $row1["user_name"]; if ($row1['vorder_currency'] != $sellerCurrency and $row1['vorder_currency'] != "USD") { $get_conversion_price = getCurrencyrate($sellerCurrency); $ordertotal = $row1["total"]; } else { $ordertotal = $row1["total"]; } $taxtotal = $row1["taxtotal"]; } $select_shipping_cost = "SELECT sd.vshipping_name, sd.nshipping_cost,od.product_name\n FROM " . $tableprefix . "shipping_details sd," . $tableprefix . "order_details od\n WHERE od.product_id=sd.nshp_productid\n AND norder_id = " . $row['order_id'] . "\n AND nshp_status = 'C'\n AND od.artist_id = '" . $artistid . "'\n GROUP BY sd.nshp_productid order by od.product_name"; $result_shipping_cost = mysql_query($select_shipping_cost); if (mysql_num_rows($result_shipping_cost) > 0) { $totalshippingcost = 0; while ($shipping_row = mysql_fetch_array($result_shipping_cost)) { $totalshippingcost += $shipping_row['nshipping_cost']; } } $csv->addRow(array($row["order_id"], html_entity_decode($adminCurrency['currency_symbol']) . " " . number_format($row["seller_order_total_amount"], 2, '.', ''), $row["commission_percentage"], html_entity_decode($adminCurrency['currency_symbol']) . " " . number_format($taxtotal, 2, '.', ''), html_entity_decode($adminCurrency['currency_symbol']) . " " . number_format($totalshippingcost, 2, '.', ''), html_entity_decode($adminCurrency['currency_symbol']) . " " . number_format($row["total_amount"], 2, '.', ''), html_entity_decode($adminCurrency['currency_symbol']) . " " . number_format($row["amount_paid"], 2, '.', ''), $txtPaymentDate, $Paymentstatus)); $artistName = $row["artist_name"]; $i++; $total += $row["amount_paid"]; } if ($total > 0) { $csv->addRow(array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ')); $csv->addRow(array(' ', ' ', ' ', ' ', ' ', ' ', 'Total Seller Amount Received', html_entity_decode($currencySymbol) . " " . number_format($total, 2, '.', ''), ' ')); } } // export csv as a download $filename = 'order_payment_details_' . $artistName; //$filename = 'order_payment_details'.$artistid; $csv->export($filename); // *or* pass the csv data to a variable as a string //$string = $csv; }