Subversion Repositories SmartDukaan

Rev

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

Rev 14090 Rev 21844
Line 27... Line 27...
27
public class SupplierController extends BaseController {
27
public class SupplierController extends BaseController {
28
    private static Log logger = LogFactory.getLog(SupplierController.class);
28
    private static Log logger = LogFactory.getLog(SupplierController.class);
29
    private String name;
29
    private String name;
30
    private String phone;
30
    private String phone;
31
    private String fax;
31
    private String fax;
32
    private String tin;
32
    private String gstin;
-
 
33
    public String getGstin() {
-
 
34
		return gstin;
-
 
35
	}
-
 
36
 
-
 
37
	public void setGstin(String gstin) {
-
 
38
		this.gstin = gstin;
-
 
39
	}
-
 
40
 
33
    private String pan;
41
	private String pan;
34
    private String headName;
42
    private String headName;
35
    private String headDesignation;
43
    private String headDesignation;
36
    private String headEmail;
44
    private String headEmail;
37
    private String contactName;
45
    private String contactName;
38
    private String contactPhone;
46
    private String contactPhone;
Line 86... Line 94...
86
        		throw new Exception("Supplier Phone is Mandatory and Should be in digits only");
94
        		throw new Exception("Supplier Phone is Mandatory and Should be in digits only");
87
        	}
95
        	}
88
        	if(fax==null || ("").equalsIgnoreCase(fax)){
96
        	if(fax==null || ("").equalsIgnoreCase(fax)){
89
        		throw new Exception("Supplier Fax is Mandatory.");
97
        		throw new Exception("Supplier Fax is Mandatory.");
90
        	}
98
        	}
91
        	if(tin==null || ("").equalsIgnoreCase(tin)){
99
        	if(gstin==null || ("").equalsIgnoreCase(gstin)){
92
        		throw new Exception("Supplier Name is Mandatory.");
100
        		throw new Exception("Supplier GSTIN is Mandatory.");
93
        	}
101
        	}
94
        	if(pan==null || ("").equalsIgnoreCase(pan)){
102
        	if(pan==null || ("").equalsIgnoreCase(pan)){
95
        		throw new Exception("Supplier PAN is Mandatory.");
103
        		throw new Exception("Supplier PAN is Mandatory.");
96
        	}
104
        	}
97
        	if(headName==null || ("").equalsIgnoreCase(headName)){
105
        	if(headName==null || ("").equalsIgnoreCase(headName)){
Line 137... Line 145...
137
            supplier.setHeadEmail(headEmail);
145
            supplier.setHeadEmail(headEmail);
138
            supplier.setHeadName(headName);
146
            supplier.setHeadName(headName);
139
            supplier.setPan(pan);
147
            supplier.setPan(pan);
140
            supplier.setPhone(phone);
148
            supplier.setPhone(phone);
141
            supplier.setRegisteredAddress(registeredAddress);
149
            supplier.setRegisteredAddress(registeredAddress);
142
            supplier.setTin(tin);
150
            //supplier.setTin(tin);
-
 
151
            supplier.setGstin(gstin);
143
            supplier.setStateId(stateId);
152
            supplier.setStateId(stateId);
144
            supplier.setPoValidityLimit(poValidityLimit);
153
            supplier.setPoValidityLimit(poValidityLimit);
145
            Client purchaseClient = new PurchaseClient().getClient();
154
            Client purchaseClient = new PurchaseClient().getClient();
146
            supplier = purchaseClient.addSupplier(supplier);
155
            supplier = purchaseClient.addSupplier(supplier);
147
            
156
            
Line 163... Line 172...
163
	            warehouse.setIsAvailabilityMonitored(false);
172
	            warehouse.setIsAvailabilityMonitored(false);
164
	            warehouse.setLocation(billingWarehouse.getLocation());
173
	            warehouse.setLocation(billingWarehouse.getLocation());
165
	            warehouse.setPincode(billingWarehouse.getPincode());
174
	            warehouse.setPincode(billingWarehouse.getPincode());
166
	            warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
175
	            warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
167
	            warehouse.setShippingWarehouseId(billingWarehouse.getId());
176
	            warehouse.setShippingWarehouseId(billingWarehouse.getId());
168
	            warehouse.setTinNumber(tin);
177
	            warehouse.setGstin(gstin);
169
	            warehouse.setTransferDelayInHours(0);
178
	            warehouse.setTransferDelayInHours(0);
170
	            warehouse.setWarehouseType(WarehouseType.OURS);
179
	            warehouse.setWarehouseType(WarehouseType.OURS);
171
	            inventoryClient.addWarehouse(warehouse);
180
	            inventoryClient.addWarehouse(warehouse);
172
	            
181
	            
173
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "B"}, '/'));
182
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "B"}, '/'));
Line 208... Line 217...
208
            supplier.setHeadEmail(headEmail);
217
            supplier.setHeadEmail(headEmail);
209
            supplier.setHeadName(headName);
218
            supplier.setHeadName(headName);
210
            supplier.setPan(pan);
219
            supplier.setPan(pan);
211
            supplier.setPhone(phone);
220
            supplier.setPhone(phone);
212
            supplier.setRegisteredAddress(registeredAddress);
221
            supplier.setRegisteredAddress(registeredAddress);
213
            supplier.setTin(tin);
222
            supplier.setGstin(gstin);
214
            supplier.setStateId(supplier.getStateId());
223
            supplier.setStateId(supplier.getStateId());
215
            supplier.setPoValidityLimit(poValidityLimit);
224
            supplier.setPoValidityLimit(poValidityLimit);
216
            purchaseClient.updateSupplier(supplier);
225
            purchaseClient.updateSupplier(supplier);
217
        } catch (Exception e) {
226
        } catch (Exception e) {
218
            errorMessage = "Error updating supplier: " + supplierName + ": " + e.getMessage();
227
            errorMessage = "Error updating supplier: " + supplierName + ": " + e.getMessage();
Line 238... Line 247...
238
        return fax;
247
        return fax;
239
    }
248
    }
240
    public void setFax(String fax) {
249
    public void setFax(String fax) {
241
        this.fax = fax;
250
        this.fax = fax;
242
    }
251
    }
243
    public String getTin() {
-
 
244
        return tin;
-
 
245
    }
-
 
246
    public void setTin(String tin) {
-
 
247
        this.tin = tin;
-
 
248
    }
-
 
249
    public String getPan() {
252
    public String getPan() {
250
        return pan;
253
        return pan;
251
    }
254
    }
252
    public void setPan(String pan) {
255
    public void setPan(String pan) {
253
        this.pan = pan;
256
        this.pan = pan;