Subversion Repositories SmartDukaan

Rev

Rev 4431 | Rev 4583 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4431 Rev 4506
Line 23... Line 23...
23
import com.google.gwt.user.client.ui.Button;
23
import com.google.gwt.user.client.ui.Button;
24
import com.google.gwt.user.client.ui.CheckBox;
24
import com.google.gwt.user.client.ui.CheckBox;
25
import com.google.gwt.user.client.ui.FlexTable;
25
import com.google.gwt.user.client.ui.FlexTable;
26
import com.google.gwt.user.client.ui.HTMLTable.Cell;
26
import com.google.gwt.user.client.ui.HTMLTable.Cell;
27
import com.google.gwt.user.client.ui.Label;
27
import com.google.gwt.user.client.ui.Label;
-
 
28
import com.google.gwt.user.client.ui.ListBox;
28
import com.google.gwt.user.client.ui.ResizeComposite;
29
import com.google.gwt.user.client.ui.ResizeComposite;
29
import com.google.gwt.user.client.ui.TextBox;
30
import com.google.gwt.user.client.ui.TextBox;
30
import com.google.gwt.user.client.ui.Widget;
31
import com.google.gwt.user.client.ui.Widget;
31
import com.google.gwt.user.datepicker.client.DateBox;
32
import com.google.gwt.user.datepicker.client.DateBox;
32
 
33
 
Line 105... Line 106...
105
    @UiField TextBox expectedDelay;
106
    @UiField TextBox expectedDelay;
106
    @UiField TextBox preferredWarehouse, defaultWarehouse;
107
    @UiField TextBox preferredWarehouse, defaultWarehouse;
107
    @UiField CheckBox defaultForEntity, risky, warehouseStickiness;
108
    @UiField CheckBox defaultForEntity, risky, warehouseStickiness;
108
    @UiField DateBox startDate;
109
    @UiField DateBox startDate;
109
    @UiField FlexTable headerSimilarItems, tableSimilarItems;
110
    @UiField FlexTable headerSimilarItems, tableSimilarItems;
-
 
111
    @UiField ListBox preferredVendor;
110
 
112
 
111
    public ItemDetails(Item item){
113
    public ItemDetails(Item item){
112
        this();
114
        this();
113
        setItemDetails(item);
115
        setItemDetails(item);
114
    }
116
    }
Line 118... Line 120...
118
        initAvailabilityHeader();
120
        initAvailabilityHeader();
119
        initVendorKeysHeader();
121
        initVendorKeysHeader();
120
        initVendorPricingHeader();
122
        initVendorPricingHeader();
121
        initSourcePricingHeader();
123
        initSourcePricingHeader();
122
        initSimilarItemList();
124
        initSimilarItemList();
-
 
125
        preferredVendor.addItem("null");
-
 
126
        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
-
 
127
        	preferredVendor.addItem(e.getValue());
-
 
128
        }
123
    }
129
    }
124
 
130
 
125
    /**
131
    /**
126
     * Sets the UI fields with item object attributes
132
     * Sets the UI fields with item object attributes
127
     * Also populates tables for vendor prices, keys and item availability
133
     * Also populates tables for vendor prices, keys and item availability
Line 139... Line 145...
139
        statusDesc.setText(item.getItemStatusDesc());
145
        statusDesc.setText(item.getItemStatusDesc());
140
        contentCategory.setText(item.getContentCategory()+"");
146
        contentCategory.setText(item.getContentCategory()+"");
141
        comments.setText(item.getComments());
147
        comments.setText(item.getComments());
142
        catalogItemId.setText(item.getCatalogItemId() + "");
148
        catalogItemId.setText(item.getCatalogItemId() + "");
143
 
149
 
-
 
150
        if(item.getPreferredVendor() != null) {
-
 
151
	        int index = 0;
-
 
152
	        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
-
 
153
	        	index++;
-
 
154
	        	if(item.getPreferredVendor() == e.getKey()) {
-
 
155
	        		preferredVendor.setSelectedIndex(index);
-
 
156
	        	}
-
 
157
	        }
-
 
158
        }
-
 
159
        else {
-
 
160
        	preferredVendor.setSelectedIndex(0);
-
 
161
        }
-
 
162
 
144
        mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
163
        mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
145
        sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
164
        sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
146
        weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
165
        weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
147
        expectedDelay.setValue(item.getExpectedDelay()+"");
166
        expectedDelay.setValue(item.getExpectedDelay()+"");
148
        preferredWarehouse.setValue(item.getPreferredWarehouse()+"");
167
        preferredWarehouse.setValue(item.getPreferredWarehouse()+"");
Line 886... Line 905...
886
        }catch(NumberFormatException nfe){
905
        }catch(NumberFormatException nfe){
887
            Window.alert("Invalid Default Warehouse");
906
            Window.alert("Invalid Default Warehouse");
888
            return false;
907
            return false;
889
        }
908
        }
890
        
909
        
-
 
910
        if(preferredVendor.getSelectedIndex() != 0) {
-
 
911
    		long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
-
 
912
            newItem.setPreferredVendor(vendorId);
-
 
913
        }
-
 
914
    	else {
-
 
915
    		newItem.setPreferredVendor(null);
-
 
916
    	}
-
 
917
        
891
        newItem.setWarehouseStickiness(warehouseStickiness.getValue());
918
        newItem.setWarehouseStickiness(warehouseStickiness.getValue());
892
        
919
        
893
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
920
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
894
          Add the instance to map and set the map to the item instance created above.*/
921
          Add the instance to map and set the map to the item instance created above.*/
895
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
922
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
Line 1088... Line 1115...
1088
            sb.append("\n-Default Warehouse");
1115
            sb.append("\n-Default Warehouse");
1089
        }
1116
        }
1090
        if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
1117
        if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
1091
            sb.append("\n-Warehouse Stickiness Flag");
1118
            sb.append("\n-Warehouse Stickiness Flag");
1092
        }
1119
        }
-
 
1120
        if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
-
 
1121
            sb.append("\n-Preferred Vendor");
-
 
1122
        }
1093
        
1123
        
1094
        VendorPricings vendorPricings;
1124
        VendorPricings vendorPricings;
1095
        long vendorId;
1125
        long vendorId;
1096
        for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
1126
        for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
1097
            vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
1127
            vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));