Subversion Repositories SmartDukaan

Rev

Rev 23085 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23085 Rev 24922
Line 1... Line 1...
1
/**
1
/**
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.inventory.controllers;
4
package in.shop2020.inventory.controllers;
5
 
5
 
-
 
6
import java.util.ArrayList;
-
 
7
import java.util.List;
-
 
8
 
-
 
9
import org.apache.commons.lang.StringUtils;
-
 
10
import org.apache.commons.logging.Log;
-
 
11
import org.apache.commons.logging.LogFactory;
-
 
12
 
6
import in.shop2020.inventory.utils.Utils;
13
import in.shop2020.inventory.utils.Utils;
7
import in.shop2020.model.v1.inventory.BillingType;
14
import in.shop2020.model.v1.inventory.BillingType;
8
import in.shop2020.model.v1.inventory.InventoryType;
15
import in.shop2020.model.v1.inventory.InventoryType;
9
import in.shop2020.model.v1.inventory.Vendor;
16
import in.shop2020.model.v1.inventory.Vendor;
10
import in.shop2020.model.v1.inventory.Warehouse;
17
import in.shop2020.model.v1.inventory.Warehouse;
Line 13... Line 20...
13
import in.shop2020.purchase.Supplier;
20
import in.shop2020.purchase.Supplier;
14
import in.shop2020.thrift.clients.InventoryClient;
21
import in.shop2020.thrift.clients.InventoryClient;
15
import in.shop2020.thrift.clients.PurchaseClient;
22
import in.shop2020.thrift.clients.PurchaseClient;
16
import in.shop2020.utils.ConfigClientKeys;
23
import in.shop2020.utils.ConfigClientKeys;
17
 
24
 
18
import java.util.List;
-
 
19
 
-
 
20
import org.apache.commons.lang.StringUtils;
-
 
21
import org.apache.commons.logging.Log;
-
 
22
import org.apache.commons.logging.LogFactory;
-
 
23
 
-
 
24
/**
25
/**
25
 * @author mandeep
26
 * @author mandeep
26
 *
27
 *
27
 */
28
 */
28
public class SupplierController extends BaseController {
29
public class SupplierController extends BaseController {
29
    private static Log logger = LogFactory.getLog(SupplierController.class);
30
	private static Log logger = LogFactory.getLog(SupplierController.class);
30
    private String name;
31
	private String name;
31
    private String phone;
32
	private String phone;
32
    private String fax;
33
	private String fax;
33
    private String gstin;
34
	private String gstin;
-
 
35
 
34
    public String getGstin() {
36
	public String getGstin() {
35
		return gstin;
37
		return gstin;
36
	}
38
	}
37
 
39
 
38
	public void setGstin(String gstin) {
40
	public void setGstin(String gstin) {
39
		this.gstin = gstin;
41
		this.gstin = gstin;
40
	}
42
	}
41
 
43
 
42
	private String pan;
44
	private String pan;
43
    private String headName;
45
	private String headName;
44
    private String headDesignation;
46
	private String headDesignation;
45
    private String headEmail;
47
	private String headEmail;
46
    private String contactName;
48
	private String contactName;
47
    private String contactPhone;
49
	private String contactPhone;
48
    private String contactFax;
50
	private String contactFax;
49
    private String contactEmail;
51
	private String contactEmail;
50
    private String registeredAddress;
52
	private String registeredAddress;
51
    private long stateId;
53
	private long stateId;
52
    private String stateIdVal;
54
	private String stateIdVal;
53
    private long poValidityLimit;
55
	private long poValidityLimit;
54
    private String communicationAddress;
56
	private String communicationAddress;
55
    private List<Long> billingWarehouseIds;
57
	private List<Long> billingWarehouseIds;
56
    private String tnc;
58
	private String tnc;
57
    
59
 
58
    private String id;
60
	private String id;
59
    private List<Supplier> suppliers;
61
	private List<Supplier> suppliers;
60
    private String errorMessage = "";
62
	private String errorMessage = "";
61
    private Supplier supplier;
63
	private Supplier supplier;
62
 
64
 
63
    public String index() {
65
	public String index() {
64
        return INDEX;
66
		return INDEX;
65
    }
67
	}
66
    
68
 
67
    /* (non-Javadoc)
69
	/*
68
     * @see in.shop2020.inventory.controllers.BaseController#edit()
70
	 * (non-Javadoc)
69
     */
71
	 * 
70
    @Override
72
	 * @see in.shop2020.inventory.controllers.BaseController#edit()
71
    public String edit() {
73
	 */
72
        try {
74
	@Override
73
            Client purchaseClient = new PurchaseClient().getClient();
75
	public String edit() {
74
            supplier = purchaseClient.getSupplier(Long.valueOf(id));
76
		try {
75
        } catch (Exception e) {
77
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient(
76
            errorMessage = "Error finding supplier: " + id + ": " + e.getMessage();
78
					ConfigClientKeys.inventory_service_server_host.toString(),
77
            logger.error("Could not find supplier: " + id, e);
79
					ConfigClientKeys.inventory_service_server_port.toString()).getClient();
78
        }
80
			Client purchaseClient = new PurchaseClient().getClient();
79
 
81
			supplier = purchaseClient.getSupplier(Long.valueOf(id));
80
        return super.edit();
82
			billingWarehouseIds = new ArrayList<Long>();
81
    }
83
			List<Warehouse> warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD,
82
 
84
					Long.valueOf(id), 0l, 0l);
83
    public String create() {
85
			for (Warehouse warehouse : warehouses) {
84
        try {
86
				billingWarehouseIds.add(warehouse.getBillingWarehouseId());
85
        	if(name==null || ("").equalsIgnoreCase(name)){
87
			}
86
        		throw new Exception("Supplier Name is Mandatory.");
88
		} catch (Exception e) {
87
        	}
89
			errorMessage = "Error finding supplier: " + id + ": " + e.getMessage();
88
        	if((phone==null || ("").equalsIgnoreCase(phone)) && !StringUtils.isNumeric(phone)){
90
			logger.error("Could not find supplier: " + id, e);
89
        		throw new Exception("Supplier Phone is Mandatory and Should be in digits only");
91
		}
90
        	}
92
 
91
        	if(fax==null || ("").equalsIgnoreCase(fax)){
93
		return super.edit();
92
        		throw new Exception("Supplier Fax is Mandatory.");
94
	}
93
        	}
95
 
94
        	if(gstin==null || ("").equalsIgnoreCase(gstin)){
96
	public String create() {
95
        		throw new Exception("Supplier GSTIN is Mandatory.");
97
		try {
96
        	}
98
			if (name == null || ("").equalsIgnoreCase(name)) {
97
        	if(pan==null || ("").equalsIgnoreCase(pan)){
99
				throw new Exception("Supplier Name is Mandatory.");
98
        		throw new Exception("Supplier PAN is Mandatory.");
100
			}
99
        	}
101
			if ((phone == null || ("").equalsIgnoreCase(phone)) && !StringUtils.isNumeric(phone)) {
100
        	if(headName==null || ("").equalsIgnoreCase(headName)){
102
				throw new Exception("Supplier Phone is Mandatory and Should be in digits only");
101
        		throw new Exception("Supplier Head Name is Mandatory.");
103
			}
102
        	}
104
			if (fax == null || ("").equalsIgnoreCase(fax)) {
103
        	if(headEmail==null || ("").equalsIgnoreCase(headEmail)){
105
				throw new Exception("Supplier Fax is Mandatory.");
104
        		throw new Exception("Supplier Head Email is Mandatory.");
106
			}
105
        	}
107
			if (gstin == null || ("").equalsIgnoreCase(gstin)) {
106
        	if(contactName==null || ("").equalsIgnoreCase(contactName)){
108
				throw new Exception("Supplier GSTIN is Mandatory.");
107
        		throw new Exception("Supplier Contact Name is Mandatory.");
109
			}
108
        	}
110
			if (pan == null || ("").equalsIgnoreCase(pan)) {
109
        	if(contactFax==null || ("").equalsIgnoreCase(contactFax)){
111
				throw new Exception("Supplier PAN is Mandatory.");
110
        		throw new Exception("Supplier Name is Mandatory.");
112
			}
111
        	}
113
			if (headName == null || ("").equalsIgnoreCase(headName)) {
112
        	if(contactPhone==null || ("").equalsIgnoreCase(contactPhone)){
114
				throw new Exception("Supplier Head Name is Mandatory.");
113
        		throw new Exception("Supplier Contact Phone is Mandatory.");
115
			}
114
        	}
116
			if (headEmail == null || ("").equalsIgnoreCase(headEmail)) {
115
        	if(registeredAddress==null || ("").equalsIgnoreCase(registeredAddress)){
117
				throw new Exception("Supplier Head Email is Mandatory.");
116
        		throw new Exception("Supplier Registered Address is Mandatory.");
118
			}
117
        	}
119
			if (contactName == null || ("").equalsIgnoreCase(contactName)) {
118
        	if(communicationAddress==null || ("").equalsIgnoreCase(communicationAddress)){
120
				throw new Exception("Supplier Contact Name is Mandatory.");
119
        		throw new Exception("Supplier Communication Address is Mandatory.");
121
			}
120
        	}
122
			if (contactFax == null || ("").equalsIgnoreCase(contactFax)) {
121
        	if(billingWarehouseIds==null || billingWarehouseIds.size()==0){
123
				throw new Exception("Supplier Name is Mandatory.");
122
        		throw new Exception("Atleast One Billing Warehouse is Mandatory.");
124
			}
123
        	}
125
			if (contactPhone == null || ("").equalsIgnoreCase(contactPhone)) {
124
        	if(billingWarehouseIds==null || billingWarehouseIds.size()==0){
126
				throw new Exception("Supplier Contact Phone is Mandatory.");
125
        		throw new Exception("Atleast One Billing Warehouse is Mandatory.");
127
			}
126
        	}
128
			if (registeredAddress == null || ("").equalsIgnoreCase(registeredAddress)) {
127
        	if(stateId == -1){
129
				throw new Exception("Supplier Registered Address is Mandatory.");
128
        		throw new Exception("State is Mandatory. Please select state");
130
			}
129
        	}
131
			if (communicationAddress == null || ("").equalsIgnoreCase(communicationAddress)) {
130
        	if(poValidityLimit < 1){
132
				throw new Exception("Supplier Communication Address is Mandatory.");
131
        		throw new Exception("PO Validity Limit Must be greater than equal to 1.");
133
			}
132
        	}
134
			if (billingWarehouseIds == null || billingWarehouseIds.size() == 0) {
133
            Supplier supplier = new Supplier();
135
				throw new Exception("Atleast One Billing Warehouse is Mandatory.");
134
            name = name.trim();
136
			}
135
            supplier.setName(name);
137
			if (billingWarehouseIds == null || billingWarehouseIds.size() == 0) {
136
            supplier.setCommunicationAddress(communicationAddress);
138
				throw new Exception("Atleast One Billing Warehouse is Mandatory.");
137
            supplier.setContactEmail(contactEmail);
139
			}
138
            supplier.setContactFax(contactFax);
140
			if (stateId == -1) {
139
            supplier.setContactName(contactName);
141
				throw new Exception("State is Mandatory. Please select state");
140
            supplier.setContactPhone(contactPhone);
142
			}
141
            supplier.setFax(fax);
143
			if (poValidityLimit < 1) {
142
            supplier.setHeadDesignation(headDesignation);
144
				throw new Exception("PO Validity Limit Must be greater than equal to 1.");
143
            supplier.setHeadEmail(headEmail);
145
			}
144
            supplier.setHeadName(headName);
146
			Supplier supplier = new Supplier();
145
            supplier.setPan(pan);
147
			name = name.trim();
146
            supplier.setPhone(phone);
148
			supplier.setName(name);
147
            supplier.setRegisteredAddress(registeredAddress);
149
			supplier.setCommunicationAddress(communicationAddress);
148
            //supplier.setTin(tin);
150
			supplier.setContactEmail(contactEmail);
149
            supplier.setGstin(gstin);
151
			supplier.setContactFax(contactFax);
150
            supplier.setStateId(stateId);
152
			supplier.setContactName(contactName);
151
            supplier.setPoValidityLimit(poValidityLimit);
153
			supplier.setContactPhone(contactPhone);
152
            supplier.setTnc(tnc);
154
			supplier.setFax(fax);
153
            Client purchaseClient = new PurchaseClient().getClient();
155
			supplier.setHeadDesignation(headDesignation);
154
            supplier = purchaseClient.addSupplier(supplier);
156
			supplier.setHeadEmail(headEmail);
155
            
157
			supplier.setHeadName(headName);
156
            in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient(ConfigClientKeys.inventory_service_server_host.toString(),
158
			supplier.setPan(pan);
157
                    ConfigClientKeys.inventory_service_server_port.toString()).getClient();
159
			supplier.setPhone(phone);
158
            Vendor vendor = new Vendor();
160
			supplier.setRegisteredAddress(registeredAddress);
159
            vendor.setId(supplier.getId());
161
			// supplier.setTin(tin);
160
            vendor.setName(name);
162
			supplier.setGstin(gstin);
161
            inventoryClient.addVendor(vendor);
163
			supplier.setStateId(stateId);
162
            for(Long billingWarehouseId : billingWarehouseIds) {
164
			supplier.setPoValidityLimit(poValidityLimit);
163
	            Warehouse billingWarehouse = inventoryClient.getWarehouse(billingWarehouseId);
165
			supplier.setTnc(tnc);
164
	            Warehouse warehouse = new Warehouse();
166
			Client purchaseClient = new PurchaseClient().getClient();
165
	            warehouse.setVendor(vendor);
167
			supplier = purchaseClient.addSupplier(supplier);
166
	            warehouse.setStateId(billingWarehouse.getStateId());
168
 
167
	            warehouse.setBillingType(BillingType.OURS);
169
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient(
168
	            warehouse.setBillingWarehouseId(billingWarehouse.getId());
170
					ConfigClientKeys.inventory_service_server_host.toString(),
169
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "G"}, '/'));
171
					ConfigClientKeys.inventory_service_server_port.toString()).getClient();
170
	            warehouse.setInventoryType(InventoryType.GOOD);
172
			Vendor vendor = new Vendor();
171
	            warehouse.setIsAvailabilityMonitored(false);
173
			vendor.setId(supplier.getId());
172
	            warehouse.setLocation(billingWarehouse.getLocation());
174
			vendor.setName(name);
173
	            warehouse.setPincode(billingWarehouse.getPincode());
175
			inventoryClient.addVendor(vendor);
174
	            warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
176
			for (Long billingWarehouseId : billingWarehouseIds) {
175
	            warehouse.setShippingWarehouseId(billingWarehouse.getId());
177
				Warehouse billingWarehouse = inventoryClient.getWarehouse(billingWarehouseId);
176
	            warehouse.setGstin(gstin);
178
				Warehouse warehouse = new Warehouse();
177
	            warehouse.setTransferDelayInHours(0);
179
				warehouse.setVendor(vendor);
178
	            warehouse.setWarehouseType(WarehouseType.OURS);
180
				warehouse.setStateId(billingWarehouse.getStateId());
179
	            inventoryClient.addWarehouse(warehouse);
181
				warehouse.setBillingType(BillingType.OURS);
180
	            
182
				warehouse.setBillingWarehouseId(billingWarehouse.getId());
181
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "B"}, '/'));
183
				warehouse.setDisplayName(
182
	            warehouse.setInventoryType(InventoryType.BAD);
184
						StringUtils.join(new String[] { billingWarehouse.getDisplayName(), name, "G" }, '/'));
183
	            inventoryClient.addWarehouse(warehouse);
185
				warehouse.setInventoryType(InventoryType.GOOD);
184
	            
186
				warehouse.setIsAvailabilityMonitored(false);
185
	            warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
187
				warehouse.setLocation(billingWarehouse.getLocation());
186
	            warehouse.setDisplayName(StringUtils.join(new String[]{name, "G"}, '/'));
188
				warehouse.setPincode(billingWarehouse.getPincode());
187
	            warehouse.setInventoryType(InventoryType.GOOD);
189
				warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
188
	            warehouse.setTransferDelayInHours(24);
190
				warehouse.setShippingWarehouseId(billingWarehouse.getId());
189
	            warehouse.setBillingType(null);
191
				warehouse.setGstin(gstin);
190
	            warehouse.setBillingWarehouseId(0);
192
				warehouse.setTransferDelayInHours(0);
191
	            warehouse.setShippingWarehouseId(0);
193
				warehouse.setWarehouseType(WarehouseType.OURS);
192
	            inventoryClient.addWarehouse(warehouse);
194
				inventoryClient.addWarehouse(warehouse);
193
	            Utils.resetSuppliers();
195
 
194
            }
196
				warehouse.setDisplayName(
195
        } catch (Exception e) {
197
						StringUtils.join(new String[] { billingWarehouse.getDisplayName(), name, "B" }, '/'));
196
            errorMessage = "Error creating supplier: " + e.getMessage();
198
				warehouse.setInventoryType(InventoryType.BAD);
197
            logger.error("Error creating supplier", e);
199
				inventoryClient.addWarehouse(warehouse);
198
        }
200
 
199
 
201
				warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
200
        return index();
202
				warehouse.setDisplayName(StringUtils.join(new String[] { name, "G" }, '/'));
201
    }
203
				warehouse.setInventoryType(InventoryType.GOOD);
202
 
204
				warehouse.setTransferDelayInHours(24);
203
    public String update() {
205
				warehouse.setBillingType(null);
204
    	logger.info("TNC == " + this.tnc);
206
				warehouse.setBillingWarehouseId(0);
205
        String supplierName = id;
207
				warehouse.setShippingWarehouseId(0);
206
        try {
208
				inventoryClient.addWarehouse(warehouse);
207
            Client purchaseClient = new PurchaseClient().getClient();
209
				Utils.resetSuppliers();
208
            Supplier supplier = purchaseClient.getSupplier(Long.valueOf(id));
210
			}
209
            supplierName = supplier.getName();
211
		} catch (Exception e) {
210
            supplier.setName(name);
212
			errorMessage = "Error creating supplier: " + e.getMessage();
211
            supplier.setCommunicationAddress(communicationAddress);
213
			logger.error("Error creating supplier", e);
212
            supplier.setContactEmail(contactEmail);
214
		}
213
            supplier.setContactFax(contactFax);
215
 
214
            supplier.setContactName(contactName);
216
		return index();
215
            supplier.setContactPhone(contactPhone);
217
	}
216
            supplier.setFax(fax);
218
 
217
            supplier.setHeadDesignation(headDesignation);
219
	public String update() {
218
            supplier.setHeadEmail(headEmail);
220
		logger.info("TNC == " + this.tnc);
219
            supplier.setHeadName(headName);
221
		String supplierName = id;
220
            supplier.setPan(pan);
222
		try {
221
            supplier.setRegisteredAddress(registeredAddress);
223
			Client purchaseClient = new PurchaseClient().getClient();
222
            supplier.setGstin(gstin);
224
			Supplier supplier = purchaseClient.getSupplier(Long.valueOf(id));
223
            supplier.setTnc(tnc);
225
			supplierName = supplier.getName();
224
            supplier.setStateId(supplier.getStateId());
226
			supplier.setName(name);
225
            supplier.setPoValidityLimit(poValidityLimit);
227
			supplier.setCommunicationAddress(communicationAddress);
226
            purchaseClient.updateSupplier(supplier);
228
			supplier.setContactEmail(contactEmail);
227
            Utils.resetSuppliers();
229
			supplier.setContactFax(contactFax);
228
        } catch (Exception e) {
230
			supplier.setContactName(contactName);
229
            errorMessage = "Error updating supplier: " + supplierName + ": " + e.getMessage();
231
			supplier.setContactPhone(contactPhone);
230
            logger.error("Error updating supplier", e);
232
			supplier.setFax(fax);
231
        }
233
			supplier.setHeadDesignation(headDesignation);
232
 
234
			supplier.setHeadEmail(headEmail);
233
        return index();
235
			supplier.setHeadName(headName);
234
    }
236
			supplier.setPan(pan);
235
 
237
			supplier.setRegisteredAddress(registeredAddress);
236
    public String getName() {
238
			supplier.setGstin(gstin);
237
        return name;
239
			supplier.setTnc(tnc);
238
    }
240
			supplier.setStateId(supplier.getStateId());
239
    public void setName(String name) {
241
			supplier.setPoValidityLimit(poValidityLimit);
240
        this.name = name;
242
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient(
241
    }
243
					ConfigClientKeys.inventory_service_server_host.toString(),
242
    public String getPhone() {
244
					ConfigClientKeys.inventory_service_server_port.toString()).getClient();
243
        return phone;
245
			Vendor vendor = inventoryClient.getVendor(supplier.getId());
244
    }
246
			for (Long billingWarehouseId : billingWarehouseIds) {
245
    public void setPhone(String phone) {
247
				Warehouse billingWarehouse = inventoryClient.getWarehouse(billingWarehouseId);
246
        this.phone = phone;
248
				Warehouse warehouse = new Warehouse();
247
    }
249
				warehouse.setVendor(vendor);
248
    public String getFax() {
250
				warehouse.setStateId(billingWarehouse.getStateId());
249
        return fax;
251
				warehouse.setBillingType(BillingType.OURS);
250
    }
252
				warehouse.setBillingWarehouseId(billingWarehouse.getId());
251
    public void setFax(String fax) {
253
				warehouse.setDisplayName(
252
        this.fax = fax;
254
						StringUtils.join(new String[] { billingWarehouse.getDisplayName(), name, "G" }, '/'));
253
    }
255
				warehouse.setInventoryType(InventoryType.GOOD);
254
    public String getPan() {
256
				warehouse.setIsAvailabilityMonitored(false);
255
        return pan;
257
				warehouse.setLocation(billingWarehouse.getLocation());
256
    }
258
				warehouse.setPincode(billingWarehouse.getPincode());
257
    public void setPan(String pan) {
259
				warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
258
        this.pan = pan;
260
				warehouse.setShippingWarehouseId(billingWarehouse.getId());
259
    }
261
				warehouse.setGstin(gstin);
260
    public String getHeadName() {
262
				warehouse.setTransferDelayInHours(0);
261
        return headName;
263
				warehouse.setWarehouseType(WarehouseType.OURS);
262
    }
264
				inventoryClient.addWarehouse(warehouse);
263
    public void setHeadName(String headName) {
265
 
264
        this.headName = headName;
266
				warehouse.setDisplayName(
265
    }
267
						StringUtils.join(new String[] { billingWarehouse.getDisplayName(), name, "B" }, '/'));
266
    public String getHeadDesignation() {
268
				warehouse.setInventoryType(InventoryType.BAD);
267
        return headDesignation;
269
				inventoryClient.addWarehouse(warehouse);
268
    }
270
 
269
    public void setHeadDesignation(String headDesignation) {
271
				warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
270
        this.headDesignation = headDesignation;
272
				warehouse.setDisplayName(StringUtils.join(new String[] { name, "G" }, '/'));
271
    }
273
				warehouse.setInventoryType(InventoryType.GOOD);
272
    public String getHeadEmail() {
274
				warehouse.setTransferDelayInHours(24);
273
        return headEmail;
275
				warehouse.setBillingType(null);
274
    }
276
				warehouse.setBillingWarehouseId(0);
275
    public void setHeadEmail(String headEmail) {
277
				warehouse.setShippingWarehouseId(0);
276
        this.headEmail = headEmail;
278
				inventoryClient.addWarehouse(warehouse);
277
    }
279
				Utils.resetSuppliers();
278
    public String getContactName() {
280
			}
279
        return contactName;
281
			purchaseClient.updateSupplier(supplier);
280
    }
282
			Utils.resetSuppliers();
281
    public void setContactName(String contactName) {
283
		} catch (Exception e) {
282
        this.contactName = contactName;
284
			errorMessage = "Error updating supplier: " + supplierName + ": " + e.getMessage();
283
    }
285
			logger.error("Error updating supplier", e);
284
    public String getContactPhone() {
286
		}
285
        return contactPhone;
287
		return index();
286
    }
288
	}
287
    public void setContactPhone(String contactPhone) {
289
 
288
        this.contactPhone = contactPhone;
290
	public String getName() {
289
    }
291
		return name;
290
    public String getContactFax() {
292
	}
291
        return contactFax;
293
 
292
    }
294
	public void setName(String name) {
293
    public void setContactFax(String contactFax) {
295
		this.name = name;
294
        this.contactFax = contactFax;
296
	}
295
    }
297
 
296
    public String getContactEmail() {
298
	public String getPhone() {
297
        return contactEmail;
299
		return phone;
298
    }
300
	}
299
    public void setContactEmail(String contactEmail) {
301
 
300
        this.contactEmail = contactEmail;
302
	public void setPhone(String phone) {
301
    }
303
		this.phone = phone;
302
    public String getRegisteredAddress() {
304
	}
303
        return registeredAddress;
305
 
304
    }
306
	public String getFax() {
305
    public void setRegisteredAddress(String registeredAddress) {
307
		return fax;
306
        this.registeredAddress = registeredAddress;
308
	}
307
    }
309
 
308
    public String getCommunicationAddress() {
310
	public void setFax(String fax) {
309
        return communicationAddress;
311
		this.fax = fax;
310
    }
312
	}
311
    public void setCommunicationAddress(String communicationAddress) {
313
 
312
        this.communicationAddress = communicationAddress;
314
	public String getPan() {
313
    }
315
		return pan;
314
 
316
	}
315
    public String getId() {
317
 
316
        return id;
318
	public void setPan(String pan) {
317
    }
319
		this.pan = pan;
318
 
320
	}
319
    public void setId(String id) {
321
 
320
        this.id = id;
322
	public String getHeadName() {
321
    }
323
		return headName;
322
 
324
	}
323
    public List<Supplier> getSuppliers() {
325
 
324
        return Utils.getSuppliers();
326
	public void setHeadName(String headName) {
325
    }
327
		this.headName = headName;
326
 
328
	}
327
    public void setSuppliers(List<Supplier> suppliers) {
329
 
328
        this.suppliers = suppliers;
330
	public String getHeadDesignation() {
329
    }
331
		return headDesignation;
330
 
332
	}
331
    public String getErrorMessage() {
333
 
332
        return errorMessage;
334
	public void setHeadDesignation(String headDesignation) {
333
    }
335
		this.headDesignation = headDesignation;
334
 
336
	}
335
    public void setErrorMessage(String errorMessage) {
337
 
336
        this.errorMessage = errorMessage;
338
	public String getHeadEmail() {
337
    }
339
		return headEmail;
338
 
340
	}
339
    public Supplier getSupplier() {
341
 
340
        return supplier;
342
	public void setHeadEmail(String headEmail) {
341
    }
343
		this.headEmail = headEmail;
342
 
344
	}
343
    public void setSupplier(Supplier supplier) {
345
 
344
        this.supplier = supplier;
346
	public String getContactName() {
345
    }
347
		return contactName;
-
 
348
	}
-
 
349
 
-
 
350
	public void setContactName(String contactName) {
-
 
351
		this.contactName = contactName;
-
 
352
	}
-
 
353
 
-
 
354
	public String getContactPhone() {
-
 
355
		return contactPhone;
-
 
356
	}
-
 
357
 
-
 
358
	public void setContactPhone(String contactPhone) {
-
 
359
		this.contactPhone = contactPhone;
-
 
360
	}
-
 
361
 
-
 
362
	public String getDisabled(long physicalWarehouseId) {
-
 
363
		return billingWarehouseIds.contains(physicalWarehouseId) ? "disabled" : "";
-
 
364
	}
-
 
365
 
-
 
366
	public String getContactFax() {
-
 
367
		return contactFax;
-
 
368
	}
-
 
369
 
-
 
370
	public void setContactFax(String contactFax) {
-
 
371
		this.contactFax = contactFax;
-
 
372
	}
-
 
373
 
-
 
374
	public String getContactEmail() {
-
 
375
		return contactEmail;
-
 
376
	}
-
 
377
 
-
 
378
	public void setContactEmail(String contactEmail) {
-
 
379
		this.contactEmail = contactEmail;
-
 
380
	}
-
 
381
 
-
 
382
	public String getRegisteredAddress() {
-
 
383
		return registeredAddress;
-
 
384
	}
-
 
385
 
-
 
386
	public void setRegisteredAddress(String registeredAddress) {
-
 
387
		this.registeredAddress = registeredAddress;
-
 
388
	}
-
 
389
 
-
 
390
	public String getCommunicationAddress() {
-
 
391
		return communicationAddress;
-
 
392
	}
-
 
393
 
-
 
394
	public void setCommunicationAddress(String communicationAddress) {
-
 
395
		this.communicationAddress = communicationAddress;
-
 
396
	}
-
 
397
 
-
 
398
	public String getId() {
-
 
399
		return id;
-
 
400
	}
-
 
401
 
-
 
402
	public void setId(String id) {
-
 
403
		this.id = id;
-
 
404
	}
-
 
405
 
-
 
406
	public List<Supplier> getSuppliers() {
-
 
407
		return Utils.getSuppliers();
-
 
408
	}
-
 
409
 
-
 
410
	public void setSuppliers(List<Supplier> suppliers) {
-
 
411
		this.suppliers = suppliers;
-
 
412
	}
-
 
413
 
-
 
414
	public String getErrorMessage() {
-
 
415
		return errorMessage;
-
 
416
	}
-
 
417
 
-
 
418
	public void setErrorMessage(String errorMessage) {
-
 
419
		this.errorMessage = errorMessage;
-
 
420
	}
-
 
421
 
-
 
422
	public Supplier getSupplier() {
-
 
423
		return supplier;
-
 
424
	}
-
 
425
 
-
 
426
	public void setSupplier(Supplier supplier) {
-
 
427
		this.supplier = supplier;
-
 
428
	}
346
 
429
 
347
	public List<Long> getBillingWarehouseIds() {
430
	public List<Long> getBillingWarehouseIds() {
348
		return billingWarehouseIds;
431
		return billingWarehouseIds;
349
	}
432
	}
350
 
433
 
351
	public void setBillingWarehouseIds(List<Long> billingWarehouseIds) {
434
	public void setBillingWarehouseIds(List<Long> billingWarehouseIds) {
352
		this.billingWarehouseIds = billingWarehouseIds;
435
		this.billingWarehouseIds = billingWarehouseIds;
353
	}
436
	}
354
 
437
 
355
    public long getStateId() {
438
	public long getStateId() {
356
		return stateId;
439
		return stateId;
357
	}
440
	}
358
    
441
 
359
    public String getStateName(long stateId){
442
	public String getStateName(long stateId) {
360
    	return Utils.getStateIdMap().get(stateId).getStateName();
443
		return Utils.getStateIdMap().get(stateId).getStateName();
361
    }
444
	}
362
 
445
 
363
	public void setStateId(long stateId) {
446
	public void setStateId(long stateId) {
364
		this.stateId = stateId;
447
		this.stateId = stateId;
365
	}
448
	}
366
 
449
 
Line 385... Line 468...
385
	}
468
	}
386
 
469
 
387
	public String getTnc() {
470
	public String getTnc() {
388
		return tnc;
471
		return tnc;
389
	}
472
	}
390
    
473
 
391
}
474
}