<% Option Explicit If not Session("isLoggedIn") Then response.redirect("/ecommerce/default.asp?returnUrl=" & Server.URLEncode(Request.ServerVariables("SCRIPT_NAME"))) End If %> <% Dim strAction, intOrderID, intToOrderID, strToOrderNumber, arrContainerIDs Dim intOrderTypeID, strOrderNumber, intFreightTypeID Dim strOrderStatusDesc, strOrderTypeDesc, intOrderStatusID, intRecUserID, strRecUserName Dim strDateOnBoard, strDateOfArrival, strPortDesc, intPortID, intShipInWeek, intThisWeekOfYear Dim dblFractionUsed, dblThisContainerTotal, dblTotalPrice Dim strSQL, rsOrder, arrDBOrdersContainersData Dim iOrdersContainerFirst, iOrdersContainerLast Dim arrDBSimilarOrderNumbers, iSimilarOrderNumbersFirst, iSimilarOrderNumbersLast Dim I, J 'isDebug = true 'isCommitDebug = false intOrderID = 0 If Request.Form("orderID") <> "" Then intOrderID = CInt(Request.Form("orderID")) intToOrderID = 0 If Request.Form("toOrderID") <> "" Then intToOrderID = CInt(Request.Form("toOrderID")) strToOrderNumber = "" If Request.Form("toOrderNumber") <> "" Then strToOrderNumber = CStr(Request.Form("toOrderNumber")) strAction = "" If Request.Form("action") <> "" Then strAction = CStr(Request.Form("action")) arrContainerIDs = null If Request.Form("containerID") <> "" Then arrContainerIDs = Split(Request.Form("containerID"), ",") intThisWeekOfYear = DatePart("WW", DateAdd("WW", 2, Date) ) 'initialise the arrays to null, indices to 0 arrDBOrdersContainersData = null iOrdersContainerFirst = 0 iOrdersContainerLast = 0 If intOrderID = 0 Then strErrMsg = strErrMsg & "
  • no order specified
  • " isErr = true Else If strAction = "split" Then If intToOrderID = 0 And strToOrderNumber = "" Then strErrMsg = strErrMsg & "
  • You must select an order to move the containers to
  • " isErr = true End If If isNull(arrContainerIDs) Then strErrMsg = strErrMsg & "
  • You must select one or more containers to move
  • " isErr = true End If If not isErr Then If intToOrderID = 0 Then ' we need to create a new order 'dump "make a new order with order number: " & strToOrderNumber strSQL = "EXEC stpOrderCopy " & intOrderID & ", " & toSQLStr(strToOrderNumber) Set rsOrder = dbconn.Execute(strSQL) If rsOrder.State <> 0 Then If not rsOrder.EOF Then intToOrderID = rsOrder("orderID") rsOrder.Close() End If If intToOrderID = 0 Then strErrMsg = strErrMsg & "
  • copying of order with ID " & intOrderID & " to new order with order number " & strToOrderNumber & " failed
  • " isErr = true End If Else strErrMsg = strErrMsg & "
  • copying of order with ID " & intOrderID & " to new order with order number " & strToOrderNumber & " failed
  • " isErr = true End If ' rsOrder.State <> 0 Set rsOrder = Nothing End If ' intToOrder = 0 If not isErr Then ' we need to move the passed container IDs to the toOrderID For I = LBound(arrContainerIDs) To UBound(arrContainerIDs) 'dump "move containers with ID " & arrContainerIDs(I) & " to order with orderID: " & intToOrderID strSQL = "EXEC stpContainerMove " & intOrderID & ", " & intToOrderID & ", " & arrContainerIDs(I) Set rsOrder = dbconn.Execute(strSQL) If rsOrder.State = 0 Then strErrMsg = strErrMsg & "
  • moving conainer with ID " & arrContainerIDs(I) & " from order with ID " & intOrderID & " to order with " & intToOrderID & " failed
  • " isErr = true End If ' rsOrder.State <> 0 Set rsOrder = Nothing Next 'If sendNotification(intOrderID) = false Then ' isErr = true ' strErrMsg = strErrMsg & "
  • Unable to send email at this time. please contact admin@cocopeat.com.au.
  • " 'End If ' bad send 'If sendNotification(intToOrderID) = false Then ' isErr = true ' strErrMsg = strErrMsg & "
  • Unable to send email at this time. please contact admin@cocopeat.com.au.
  • " 'End If ' bad send End If ' not isErr creating new order End If ' not isErr with input End If ' intToOrder = 0 ' we have an order ID ' assign the container data for this order to a 2d array strSQL = "EXEC stpOrdersContainersSelect " & intOrderID outStr = outStr & strSQL Set rsOrder = dbconn.Execute(strSQL) If rsOrder.EOF Then strErrMsg = "
  • no containers belong to order " & intOrderID & "
  • " isErr = true Else arrDBOrdersContainersData = rsOrder.GetRows() iOrdersContainerFirst = LBound(arrDBOrdersContainersData, 2) iOrdersContainerLast = UBound(arrDBOrdersContainersData, 2) rsOrder.Close Set rsOrder = Nothing End If ' EOF ' get the current status and other order specific details strSQL = "EXEC stpOrderDetailsSelect " & intOrderID Set rsOrder = dbconn.Execute(strSQL) If not rsOrder.EOF Then intOrderTypeID = rsOrder("orderTypeID") strOrderNumber = rsOrder("orderCode") intFreightTypeID = rsOrder("freightTypeID") strOrderStatusDesc = rsOrder("orderStatusDesc") strOrderTypeDesc = rsOrder("orderTypeDesc") intOrderStatusID = rsOrder("orderStatusID") intRecUserID = rsOrder("recUserID") If not isNull(rsOrder("dateOnBoard")) Then strDateOnBoard = toSQLDate(rsOrder("dateOnBoard"), SQLTODATE_ABBR_MONTH) If not isNull(rsOrder("dateOfArrival")) Then strDateOfArrival = toSQLDate(rsOrder("dateOfArrival"), SQLTODATE_ABBR_MONTH) strPortDesc = rsOrder("portDesc") intPortID = rsOrder("portID") intShipInWeek = rsOrder("shipInWeek") rsOrder.Close Set rsOrder = Nothing End If ' EOF ' get the receiving user's username strSQL = "EXEC stpUserNameSelect " & intRecUserID Set rsOrder = dbconn.Execute(strSQL) If rsOrder.EOF Then strErrMsg = "
  • no username for order receiver" & intRecUserID & "
  • " isErr = true Else strRecUserName = rsOrder("username") rsOrder.Close Set rsOrder = Nothing End If ' EOF End If If isDebug Then dump(outStr) ' Call dumpForm %> Galuku Cocopeat

    Split Order - Order Number: <%= strOrderNumber %> - Container Summary

    <% If isErr Then %> <% End If %>
    The following errors occurred:
      <%= strErrMsg %>
    Ordered by - <%= strRecUserName %>   |    arriving <%= strPortDesc %>   |    ship in week <%= intShipInWeek %> (<% If intShipInWeek < intThisWeekOfYear Then %><%= toSQLDate(GetStartDateOfWeekInYear(intShipInWeek + 52), SQLTODATE_ABBR_MONTH) %><% Else %><%= toSQLDate(GetStartDateOfWeekInYear(intShipInWeek),1) %><% End If %>)
    <% If Session("intUserTypeID") <= 2 Then %>Ordered at <%= strOrderTypeDesc %>   |   <% End If %>Status - <%= strOrderStatusDesc %>
    <% ' show this order's containers If not isnull(arrDBOrdersContainersData) Then For I = iOrdersContainerFirst To iOrdersContainerLast ' only show containers that dont have a container number If isNull(arrDBOrdersContainersData(3,I)) or arrDBOrdersContainersData(3,I) = "" Then dblFractionUsed = GetFractionUsed(arrDBOrdersContainersData(0,I)) dblThisContainerTotal = 0 %>
    Container ID: <%= arrDBOrdersContainersData(0,I) %> (<%= I+1 %> of <%= iOrdersContainerLast + 1 %>) <%= Round(dblFractionUsed * 100, 2) %>% Full <%= arrDBOrdersContainersData(2,I) %> FCL #[ <% If isNull(arrDBOrdersContainersData(3,I)) or arrDBOrdersContainersData(3,I) = "" Then %>TBA<% Else %><%= arrDBOrdersContainersData(3,I) %><% End If %> ] STC:
    Move This Container checked<% End If Next End If %>>    |    Show Container Details
    Total for this container: <%= FormatCurrency(dblThisContainerTotal) %>

    <% Else %>
    Container <%= arrDBOrdersContainersData(0,I) %> has a container number entered and cannot be moved from this order

    <% End If ' not isnull container number Next End If ' not isnull(arrDBOrdersContainersData) ' set the next new orderNumber arrDBSimilarOrderNumbers = null strSQL = "EXEC stpOrderSimilarSelect " & toSQLStr(strOrderNumber) ' returns a list of orderNumbers that are sub-numbers of this number Set rsOrder = dbconn.Execute(strSQL) If rsOrder.State <> 0 Then If not rsOrder.EOF Then arrDBSimilarOrderNumbers = rsOrder.GetRows() iSimilarOrderNumbersFirst = LBound(arrDBSimilarOrderNumbers, 2) iSimilarOrderNumbersLast = UBound(arrDBSimilarOrderNumbers, 2) rsOrder.Close() End If End If Set rsOrder = Nothing %>

    Move Containers To

    Next New Order: <%= GetNextOrderNumber(strOrderNumber, arrDBSimilarOrderNumbers) %> checked<% End If %>>
    <% If not isNull(arrDBSimilarOrderNumbers) Then For J = iSimilarOrderNumbersFirst To iSimilarOrderNumbersLast arrDBOrdersContainersData = null ' assign the container data for this order to a 2d array strSQL = "EXEC stpOrdersContainersSelect " & arrDBSimilarOrderNumbers(0, J) outStr = outStr & strSQL Set rsOrder = dbconn.Execute(strSQL) If rsOrder.State <> 0 Then If rsOrder.EOF Then strErrMsg = "
  • no containers belong to order " & arrDBSimilarOrderNumbers(0, J) & "
  • " isErr = true Else arrDBOrdersContainersData = rsOrder.GetRows() iOrdersContainerFirst = LBound(arrDBOrdersContainersData, 2) iOrdersContainerLast = UBound(arrDBOrdersContainersData, 2) End If ' EOF rsOrder.Close End If Set rsOrder = Nothing ' get the current status and other order specific details strSQL = "EXEC stpOrderDetailsSelect " & arrDBSimilarOrderNumbers(0, J) Set rsOrder = dbconn.Execute(strSQL) If not rsOrder.EOF Then intOrderTypeID = rsOrder("orderTypeID") strOrderNumber = rsOrder("orderCode") intFreightTypeID = rsOrder("freightTypeID") strOrderStatusDesc = rsOrder("orderStatusDesc") strOrderTypeDesc = rsOrder("orderTypeDesc") intOrderStatusID = rsOrder("orderStatusID") intRecUserID = rsOrder("recUserID") If not isNull(rsOrder("dateOnBoard")) Then strDateOnBoard = toSQLDate(rsOrder("dateOnBoard"), SQLTODATE_ABBR_MONTH) If not isNull(rsOrder("dateOfArrival")) Then strDateOfArrival = toSQLDate(rsOrder("dateOfArrival"), SQLTODATE_ABBR_MONTH) strPortDesc = rsOrder("portDesc") intPortID = rsOrder("portID") intShipInWeek = rsOrder("shipInWeek") rsOrder.Close Set rsOrder = Nothing End If ' EOF %>

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

    Move Selected Containers To Order <%= strOrderNumber %> checked<% End If %>><% If not isNull(arrDBOrdersContainersData) Then%>    |    Show Order Details<% End If %>
    Ordered by - <%= strRecUserName %>   |    arriving <%= strPortDesc %>   |    ship in week <%= intShipInWeek %> (<% If intShipInWeek < intThisWeekOfYear Then %><%= toSQLDate(GetStartDateOfWeekInYear(intShipInWeek + 52), SQLTODATE_ABBR_MONTH) %><% Else %><%= toSQLDate(GetStartDateOfWeekInYear(intShipInWeek),1) %><% End If %>)
    <% If Session("intUserTypeID") <= 2 Then %>Ordered at <%= strOrderTypeDesc %>   |   <% End If %>Status - <%= strOrderStatusDesc %>
    <% Next End If %>
    <% If strAction <> "" And not isErr And intOrderID <> 0 Then %> <% End If %>
    edit successful
     
    Move Selected Containers    |    Return to Order Summary   

    ^ back to top