<% Option Explicit If not Session("isLoggedIn") Then response.redirect("/ecommerce/default.asp") End If %> <% Dim intContainerID, intContainerNum, intItemID, intNumberOfItem, strAction Dim intOrderID, strOrderNumber, intContainerTot, intContainerTypeID, strContainerSize, strNotes, strContainerNumber Dim intOrderTypeID, intFreightTypeID, intRecUserID, dblSalePrice Dim intOrderStatusID, strOrderStatusDesc, intNewOrderStatusID, strNewOrderStatusDesc Dim rs, arrDBContainersItemsData, arrLoadTypeData, strSQL Dim iRecFirst, iRecLast Dim I, J Dim rsNotes, rsOrder Dim strSelectHTML Dim dblFractionUsed, dblRunningTotal Dim intSpaceForThisItemLeftOnThisContainer ' stupid name, but i know exactly what it does!!! Dim arrDBOrdersContainersData, iOrderFirst, iOrderLast Dim rsItemList, rsItemCategoryList, dblTotalCapacity, spaceLeft, JsStr 'isDebug = true 'isCommitDebug = false dblRunningTotal = 0 dblFractionUsed = 0 intContainerID = 0 If Request.Form("containerID") <> "" Then intContainerID = CInt(Request.Form("containerID")) intItemID = 0 If Request.Form("itemID") <> "" Then intItemID = CInt(Request.Form("itemID")) intNumberOfItem = 0 If Request.Form("numberOfItem") <> "" Then intNumberOfItem = CInt(Request.Form("numberOfItem")) strAction = "view" If Request.Form("action") <> "" Then strAction = CStr(Request.Form("action")) intRecUserID = 0 If Request.Form("recUserID") <> "" Then intRecUserID = CInt(Request.Form("recUserID")) intContainerNum = 0 If Request.Form("containerNum") <> "" Then intContainerNum = CInt(Request.Form("containerNum")) intContainerTot = 0 If Request.Form("containerTot") <> "" Then intContainerTot = CInt(Request.Form("containerTot")) intContainerTypeID = 0 If Request.Form("containerTypeID") <> "" Then intContainerTypeID = CInt(Request.Form("containerTypeID")) strContainerSize = 0 If Request.Form("containerSize") <> "" Then strContainerSize = CStr(Request.Form("containerSize")) strNotes = "" If Request.Form("notes") <> "" Then strNotes = FixEditableHTML(CStr(Request.Form("notes"))) If LCase(strNotes) = "

 

" or LCase(strNotes) = "

" Then strNotes = "" End If Dim strHtmlNotes strNotes = strNotes strNotes = Replace(strNotes, vbcr, "
") strNotes = Replace(strNotes, vblf, "
") strContainerNumber = "" If Request.Form("containerNumber") <> "" Then strContainerNumber = CStr(Request.Form("containerNumber")) intOrderID = 0 If Request.Form("orderID") <> "" Then intOrderID = CInt(Request.Form("orderID")) intOrderTypeID = 0 If Request.Form("orderTypeID") <> "" Then intOrderTypeID = CInt(Request.Form("orderTypeID")) intFreightTypeID = 0 If Request.Form("freightTypeID") <> "" Then intFreightTypeID = CInt(Request.Form("freightTypeID")) intOrderStatusID = 0 If Request.Form("orderStatusID") <> "" Then intOrderStatusID = CInt(Request.Form("orderStatusID")) strOrderNumber = "" If Request.Form("orderNumber") <> "" Then strOrderNumber = CStr(Request.Form("orderNumber")) strOrderStatusDesc = "" If Request.Form("orderStatusDesc") <> "" Then strOrderStatusDesc = CStr(Request.Form("orderStatusDesc")) dblSalePrice = 0 If Request.Form("salePrice") <> "" Then dblSalePrice = CDbl(Request.Form("salePrice")) ' supplier sees cost price If session("intUserTypeID") = USERTYPE_SUPPLIER Then intOrderTypeID = ORDERTYPE_COSTPRICE intRecUserID = USERID_ADMIN End If 'initalise data arrays arrDBContainersItemsData = null iRecFirst = 0 iRecLast = 0 arrDBOrdersContainersData = null iOrderFirst = 0 iOrderLast = 0 If intContainerID = 0 Then strErrMsg = "
  • no container specified
  • " isErr = true Else ' determine what fraction of the container is being used If LCase(strAction) = "add" Then fnAddItem intContainerID, intItemID, intNumberOfItem, dblSalePrice, strErrMsg, isErr End If If LCase(strAction) = "del" Then fnDeleteItem intContainerID, intItemID, strErrMsg, isErr End If If LCase(strAction) = "save" Then fnSaveItem intContainerID, intItemID, intNumberOfItem, dblSalePrice, strErrMsg, isErr End If If LCase(strAction) = "savenotes" Then fnSaveNotes intContainerID, strNotes, strErrMsg, isErr End If If LCase(strAction) = "savedetails" Then fnSaveDetails intContainerID, strContainerNumber, strErrMsg, isErr End If If LCase(strAction) = "saveall" Then fnSaveNotes intContainerID, strNotes, strErrMsg, isErr fnSaveDetails intContainerID, strContainerNumber, strErrMsg, isErr End If dblFractionUsed = GetFractionUsed(intContainerID) ' get the items that are in this container ' containerID, itemID, numberOfItem, itemCategoryID, itemName, itemDesc, count29, count40, loadTypeID, loadTypeDesc, ItemsPerUnit, containerTypeID strSQL = "EXEC stpContainersItemsSelect " & intContainerID & ", " & intOrderTypeID ' & ", " & intRecUserID 'dump strSQL Set rs = dbconn.Execute(strSQL) If rs.EOF Then iRecFirst = 0 iRecLast = -1 Else arrDBContainersItemsData = rs.GetRows() iRecFirst = LBound(arrDBContainersItemsData, 2) iRecLast = UBound(arrDBContainersItemsData, 2) rs.Close Set rs = Nothing End If ' EOF ' Get the containers belonging to this order strSQL = "EXEC stpOrdersContainersSelect " & intOrderID Set rsOrder = dbconn.Execute(strSQL) If rsOrder.State <> 0 Then If not rsOrder.EOF Then arrDBOrdersContainersData = rsOrder.GetRows() iOrderFirst = LBound(arrDBOrdersContainersData, 2) iOrderLast = UBound(arrDBOrdersContainersData, 2) rsOrder.Close() End If End If Set rsOrder = Nothing ' Get this order's container details For I = iOrderFirst To iOrderLast If arrDBOrdersContainersData(0,I) = intContainerID Then strNotes = arrDBOrdersContainersData(5,I) If not isnull(strNotes) Then strNotes = Replace(strNotes, "
    ", vbcrlf) End If strContainerNumber = arrDBOrdersContainersData(3,I) Exit For End If Next End If ' containerID = 0 If isDebug Then dump(outStr) %> Galuku Cocopeat
    <% ' if the user is a supplier and the status is confirmed, ie ready to be shipped If ((Session("intUserTypeID") = USERTYPE_SUPPLIER And intOrderStatusID = 3) or (Session("intUserTypeID") = USERTYPE_ADMIN)) Then %> <% End If %>

    Edit Container - Order Number: <%= strOrderNumber %>

    <% If isErr Then %>
    The following errors occurred:
      <%= strErrMsg %>
    <% End If If not isNull(arrDBOrdersContainersData) Then %>
    Container <%=intContainerNum%> of <%=intContainerTot%> - Go to:
    <% End If %>

    Container Details

    <% ' if we can still add items to the container, show main select list If not isContainerFull(dblFractionUsed) Then if strAction <> "edit" then %>

     X   @  = Add to container
    <% end if ' strAction=edit End If ' not containerFull %>
    Container ID: <%= intContainerID %> (<%= intContainerNum%> of <%= intContainerTot %>) <%= Round(dblFractionUsed * 100, 2) %>% Full <%= strContainerSize %> FCL #[ <% If isNull(strContainerNumber) or strContainerNumber = "" Then %>TBA<% Else %><%= strContainerNumber %><% End If %> ] STC:
    <% ' show a warning if container is full If isContainerFull(dblFractionUsed) Then %> <% End If ' isContainerFull If not isNull(arrDBContainersItemsData) Then For I = iRecFirst To iRecLast Dim strItemID, intItemNum, strLoadType, intLoadTypeID, strItemName, strItemDesc, dblItemPrice, dblPerItemPrice, dblItemCapacity Dim dblTotalPrice, strBGColor, intItemsPerUnit, intUnitsPerCarton, intCount20, intCount40, dblFreightCost strItemID = arrDBContainersItemsData(1,I) intItemNum = arrDBContainersItemsData(2,I) intLoadTypeID = arrDBContainersItemsData(9,I) strLoadType = GetLoadType(intLoadTypeID) strItemName = arrDBContainersItemsData(4,I) strItemDesc = arrDBContainersItemsData(5,I) intItemsPerUnit = arrDBContainersItemsData(11,I) intUnitsPerCarton = arrDBContainersItemsData(12,I) intCount20 = arrDBContainersItemsData(7,I) intCount40 = arrDBContainersItemsData(8,I) dblFreightCost = 0 dblItemCapacity = 0 If (intFreightTypeID = FREIGHTTYPE_COSTANDFREIGHT) and (intOrderTypeID = ORDERTYPE_INTLPRICE) Then dblItemCapacity = GetItemCapacity(arrDBContainersItemsData(13,I), arrDBContainersItemsData(9,I), arrDBContainersItemsData(11,I), arrDBContainersItemsData(12,I), arrDBContainersItemsData(7,I), arrDBContainersItemsData(8,I)) dblFreightCost = GetFreightCost(intOrderID, arrDBContainersItemsData(13,I)) / dblItemCapacity End If dblPerItemPrice = CDbl(arrDBContainersItemsData(6,I)) + dblFreightCost If isDebug Then %> <% End If dblItemPrice = GetItemPrice(arrDBContainersItemsData(9,I), dblPerItemPrice, arrDBContainersItemsData(11,I), arrDBContainersItemsData(12,I), arrDBContainersItemsData(7,I), arrDBContainersItemsData(8,I), arrDBContainersItemsData(13,I), intFreightTypeID, intOrderTypeID) dblTotalPrice = intItemNum * dblItemPrice If I mod 2 = 1 then strBGColor = "#CCCC99" else strBGColor = "#CCCCaa" End If ' containerID, tblItem.itemID AS itemID, numberOfItem, tblContainerItem.isActive AS isActive, itemCategoryID, itemName, itemDesc, price AS itemPrice, count20, count40, tblItem.loadTypeID, loadTypeDesc %> <% ' if command was to edit, and the itemID passed matches the currect itemID, show input field and save/cancel button if strAction = "edit" and intItemID = cint(strItemID) then ' work out how many items for the items loadtype will fit into the container intSpaceForThisItemLeftOnThisContainer = GetSpaceLeft(GetTotalCapacity(arrDBContainersItemsData(13,I),arrDBContainersItemsData(9,I),arrDBContainersItemsData(7,I),arrDBContainersItemsData(8,I)), dblFractionUsed) %> <% ' we aren't editing this item else %> <% end if %> <% Next End If %>
    This container is FULL.
    Freight TypeID: <%= intFreightTypeID %> OrderTypeID: <%= intOrderTypeID %> FREIGHTTYPE_COSTANDFREIGHT: <%= FREIGHTTYPE_COSTANDFREIGHT %>
    Freight Cost: <%= GetFreightCost(intOrderID, arrDBContainersItemsData(13,I)) %> Item Capacity: <%= dblItemCapacity %>
    dblPerItemPrice: <%= dblPerItemPrice %> dblFreightCost: <%= dblFreightCost %>
    (+ <%=intSpaceForThisItemLeftOnThisContainer%>) <%=strLoadType%>
    <%=strItemName %> @ $<%= dblItemPrice %> = $<%=dblTotalPrice%>
    Save  |  Cancel <%=intItemNum%> <%=strLoadType%> <%=strItemName & " " & strItemDesc %> @ <%= FormatCurrency(dblItemPrice) %> = <%= FormatCurrency(dblTotalPrice) %><% dblRunningTotal = dblRunningTotal + CDbl(dblTotalPrice) %> Delete  |  Edit

    Container Notes:

    <% If true Then %> <% Else %>
    <%= strNotes %>
    <% End If %>
    Save Notes
    Total price for container: <%= FormatCurrency(dblRunningTotal) %>

    Container Shipping Details

    Container Number:

    <% If strContainerNumber = "" Then %>no number<% Else %><%= strContainerNumber %><% End If %>
    <% If strAction <> "view" And not isErr And intContainerID <> 0 Then %> <% End If %>
    edit successful
     
    <% If ((Session("intUserTypeID") = 3 And intOrderStatusID = ORDERSTATUS_ORDER_IN_PROGRESS) or (Session("intUserTypeID") = 1)) Then %> Save Container Number    |   <% End If %> Return to Order Summary  

    ^ back to top