Untitled

 avatar
unknown
plain_text
10 months ago
2.3 kB
18
Indexable
; Location dropdown with corrected tooltip
global locationDropdown := myGui.AddDropDownList("x40 y110 w220 h200 Choose1 vLocationSelect", ["Warrior Close", "Speedwell Close", "Hamble SP1", "Hamble SP4", "Mount Park", "Delta Park"])
locationDropdown.BackColor := 0x3C3C3C
locationDropdown.SetFont("s10", "Segoe UI Variable")

; Add Refurbished checkbox next to the location dropdown
global chkRefurbished := myGui.AddCheckbox("x270 y112 w100 h20 vRefurbished", "Refurbished?")
chkRefurbished.BackColor := 0x252526
chkRefurbished.TextColor := 0xFFFFFF
chkRefurbished.SetFont("s9", "Segoe UI Variable")
chkRefurbished.Value := 0  ; Default unchecked

GetLocationCode() {
    ; Function to get the appropriate code based on selected location and refurbished status
    selectedLocation := locationDropdown.Text
    isRefurbished := chkRefurbished.Value
    
    ; Base location codes
    baseCode := ""
    switch selectedLocation {
        case "Warrior Close":
            baseCode := "WC"
        case "Speedwell Close":
            baseCode := "SW"
        case "Hamble SP1":
            baseCode := "HM1"
        case "Hamble SP4":
            baseCode := "HM4"
        case "Mount Park":
            baseCode := "MP"
        case "Delta Park":
            baseCode := "DP"
        default:
            baseCode := "WC"
    }
    
    ; Add RF suffix if refurbished is checked, otherwise add ENG
    if (isRefurbished) {
        return baseCode . "_RF_ENG"
    } else {
        return baseCode . "_ENG"
    }
}




GetLocationMessage(isLastOne) {
    ; Function to get the appropriate message based on selected location, refurbished status, and last item status
    selectedLocation := locationDropdown.Text
    isRefurbished := chkRefurbished.Value
    
    locationName := selectedLocation
    if (isRefurbished) {
        locationName .= " Refurbished"
    }
    
    if (selectedLocation = "Warrior Close") {
        if (isLastOne)
            return "Taken from " . locationName . " Store - 0 Stock"
        else
            return "Taken from " . locationName . " Store"
    } else {
        ; For Hamble SP1, Hamble SP4, and Speedwell
        if (isLastOne)
            return "Please deliver to Warrior Close - 0 Stock"
        else
            return "Please deliver to Warrior Close"
    }
}
















Editor is loading...
Leave a Comment