@include('./admin/util/header')

Orders

@php $rowFormat=''; $dateAdded='Need to add'; $orderIDLink =''; $editOrderLink =''; $previewLink =''; $editGroupLink=''; $fullNameLink=''; $invoiceTotalText=''; $datePaidText=''; $shipText=''; $dateCancelledLink=''; $orderID=''; $delLink=''; $itemsWholesaleTotal=0; $pageSingle=''; $salesTotal = 0; $receivedTotal = 0; @endphp @foreach($results as $order) @php $ID = $order->ID; $orderID = $order->orderID; $dateAdded = setDateV2($order->dateAdded); $groupCode = $order->groupCode; $editGroupLink = "" . $groupCode . ""; if (is_null($order->groupCode) || $order->groupCode == "") { $editGroupLink = "N/A"; } $invoiceTotal = $order->invoiceTotal; if (!is_null($invoiceTotal)) { $invoiceTotal = (double) $invoiceTotal; } if (!is_numeric($invoiceTotal)) { $invoiceTotal = 0; } $invoiceTotalText = currencyTest($invoiceTotal); // ../ssi/functions_extras $orderTypeID = $order->orderTypeID; if ($orderTypeID == 0) { $invoiceTotalText = "" . $invoiceTotalText . ""; } $firstName = $order->firstName; $lastName = $order->lastName; $fullName = $firstName . " " . $lastName; $fullNameLink = "" . $fullName . ""; $orderIDLink = " $ID, 'orderID' => $orderID]) . "' class='tableLink'>" . $orderID . ""; $editOrderLink = " $orderID, 'ID' => $ID]) . "'>New order"; $datePaid = $order->datePaid; if ( $datePaid !="0000-00-00" &&isDate($datePaid)) { $payMethodID = $order->payMethodID; $payMethodText = getPaymentText($payMethodID); // functions_formatting $datePaidText = "" . setDateV2($datePaid) . "
" . $payMethodText; if (isNull($order->dateCancelled)) { // RFQ's are never marked as paid $receivedTotal += $invoiceTotal; } } else { // $datePaidText = "Pay"; $datePaidText = "Pay"; } $shipDate = $order->shipDate; if ( $shipDate !="0000-00-00" && isDate($shipDate)) { $shipMethod = ($order->shipMethod); // ../ssi/functions_record_display -   $shipText = setDateV2($shipDate) . " 
" . $shipMethod; $colorCode = $order->colorCode; if (!isNull($colorCode)) { $shipText = "" . $shipText . ""; } } else { $shipText = "Ship"; } $dateCancelledLink = addSpace($order->dateCancelled); // ../ssi/functions_record_display -   if ($dateCancelledLink != " ") { // order was cancelled $dateCancelledLink = "" . setDateV2($order->dateCancelled) . ""; if (!isDate($datePaid)) { $datePaidText = " "; } if (!isDate($shipDate)) { $shipText = " "; } $invoiceTotalText = "" . $invoiceTotalText . ""; $itemsWholesaleTotal = "" . $itemsWholesaleTotal . ""; $delLink = " "; } else { $salesTotal += $invoiceTotal; // Are there terms for this order? // dd($salesTotal); if (!empty($order->termsID) && !isNull($order->termsID) && !isNull($shipDate) && isNull($datePaid)) { $termDays = $order->termDays; if (isNull($termDays) || $termDays == "") { $termDays = 0; } if (date("Y-m-d") >= date("Y-m-d", strtotime($shipDate . " + $termDays days"))) { // and not isDate(datePaid) then $dateCancelledLink = "Past Due"; } } } $previewLink = " $orderID]) . "' class='tableLink'>"; $delLink = "Select this " . $pageSingle . " to be cancelled"; // if (!session("adminAccess")) { // $delLink = " "; // } if ( $order->dateCancelled !="0000-00-00" && (isDate($shipDate) || isDate($order->dateCancelled))) { $delLink = " "; } @endphp @endforeach
Date # First / last name Amount Date paid Ship date Cancelled
   
@include('../util/footer')