Subversion Repositories SmartDukaan

Rev

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

Rev 5504 Rev 5516
Line 26... Line 26...
26
                            PAUSED = 2,
26
                            PAUSED = 2,
27
                            ACTIVE = 3,
27
                            ACTIVE = 3,
28
                            IN_PROCESS = 4,
28
                            IN_PROCESS = 4,
29
                            CONTENT_COMPLETE = 5;
29
                            CONTENT_COMPLETE = 5;
30
    
30
    
31
    public static List<String> voucherType;
-
 
32
    
-
 
33
    // role column in helper.catalogdashboarduser table. role specifies 
31
    // role column in helper.catalogdashboarduser table. role specifies 
34
    // the username-pwd pair for staging or for production.
32
    // the username-pwd pair for staging or for production.
35
    // production password is needed while updating item on production server.
33
    // production password is needed while updating item on production server.
36
    public static final int ROLE_STAGING = 0, ROLE_PRODUCTION = 1;
34
    public static final int ROLE_STAGING = 0, ROLE_PRODUCTION = 1;
37
    
35
    
38
    private static Map<Long, String> vendors, warehouses, sources;
36
    private static Map<Long, String> vendors, warehouses, sources, voucherType;
39
    private static List<String> categories, brands;
37
    private static List<String> categories, brands;
40
    
38
    
41
    private static final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
39
    private static final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
42
    
40
    
43
    static {
41
    static {
Line 94... Line 92...
94
            public void onFailure(Throwable caught) {
92
            public void onFailure(Throwable caught) {
95
                caught.printStackTrace();
93
                caught.printStackTrace();
96
            }
94
            }
97
        });
95
        });
98
        
96
        
99
        catalogService.getvoucherTypes(new AsyncCallback<List<String>>() {
97
        catalogService.getvoucherTypes(new AsyncCallback<Map<Long,String>>() {
100
            @Override
98
            @Override
101
            public void onSuccess(List<String> result) {
99
            public void onSuccess(Map<Long,String> result) {
102
            	voucherType = result;
100
            	setVoucherType(result);
103
            }
101
            }
104
            @Override
102
            @Override
105
            public void onFailure(Throwable caught) {
103
            public void onFailure(Throwable caught) {
106
                caught.printStackTrace();
104
                caught.printStackTrace();
107
            }
105
            }
Line 147... Line 145...
147
        if(warehouses == null) {
145
        if(warehouses == null) {
148
            return null;
146
            return null;
149
        }
147
        }
150
        return warehouses.get(id);
148
        return warehouses.get(id);
151
    }
149
    }
152
 
150
    
-
 
151
    public static long getVoucherTypeId(String voucherDesc) {
-
 
152
        if(voucherType == null) {
-
 
153
            return 0;
-
 
154
        }
-
 
155
        for(Entry<Long, String> v : voucherType.entrySet()) {
-
 
156
            if(v.getValue().equals(voucherDesc)) {
-
 
157
                return v.getKey();
-
 
158
            }
-
 
159
        }
-
 
160
        return 0;
-
 
161
    }
-
 
162
    
153
    public static String getDisplayableDate(Long millis){
163
    public static String getDisplayableDate(Long millis){
154
        Date date = new Date();
164
        Date date = new Date();
155
        date.setTime(millis);
165
        date.setTime(millis);
156
        String dateString = date.toString();
166
        String dateString = date.toString();
157
        dateString = dateString.substring(0, dateString.lastIndexOf(" "));
167
        dateString = dateString.substring(0, dateString.lastIndexOf(" "));
Line 284... Line 294...
284
            default: return false;
294
            default: return false;
285
            }
295
            }
286
        }
296
        }
287
        return true;
297
        return true;
288
    }
298
    }
-
 
299
 
-
 
300
	public static void setVoucherType(Map<Long, String> voucherType) {
-
 
301
		Utils.voucherType = voucherType;
-
 
302
	}
-
 
303
 
-
 
304
	public static Map<Long, String> getVoucherType() {
-
 
305
		return voucherType;
-
 
306
	}
289
}
307
}