Subversion Repository Public Repository

TransPort_Tracking

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.transtracking.controller;

import com.bestray.transporttracking.DataSourceObject;
import com.bestray.transtracking.dao.impl.CodeDaoImpl;
import com.bestray.transtracking.dto.ClientCollectionSearchDTO;
import com.bestray.transtracking.service.ClientCollectionService;
import com.bestray.transtracking.service.ClientService;
import com.bestray.transtracking.service.CodeService;
import com.bestray.transtracking.service.EmployeeService;
import com.bestray.transtracking.service.JobEntryService;
import com.bestray.transtracking.service.impl.ClientCollectionServiceImpl;
import com.bestray.transtracking.service.impl.ClientServiceImpl;
import com.bestray.transtracking.service.impl.CodeServiceImpl;
import com.bestray.transtracking.service.impl.EmployeeServiceImpl;
import com.bestray.transtracking.service.impl.JobEntryServiceImpl;
import com.bestray.trastrack.domain.ClientCollection;
import com.bestray.trastrack.domain.ClientUser;
import com.bestray.trastrack.domain.Code;
import com.bestray.trastrack.domain.CollectionCalcu;
import com.bestray.trastrack.domain.Employee;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Vector;

/**
 *
 * @author user3
 */
public class ClientCollectionController {
    
    private CodeService codeService ;
   // private CodeDaoImpl codeDao;
    private ClientService clientservice;
    private ClientCollectionService collectionservice;
    private EmployeeService employeeService;
    private JobEntryService jeservice;
    public static final String COLLECTION_CATAGORY = "COLLECTION_CATAGORY";
    private SimpleDateFormat sdf;
    
    
    public ClientCollectionController(){
        collectionservice = new ClientCollectionServiceImpl();
        clientservice = new ClientServiceImpl();
        codeService = new CodeServiceImpl();
        jeservice = new JobEntryServiceImpl();
        employeeService = new EmployeeServiceImpl();
        sdf = new SimpleDateFormat("dd/MM/yyyy");
    }
    
    public boolean clientCollection(ClientCollection collect){
        return collectionservice.collectClient(collect);     
                
    }
     
    public Vector<Code> getCodeList() {
        Vector codes = new Vector();
        
        List<Code> codeList = codeService.getCodesByCodeTypeName(COLLECTION_CATAGORY);
        for(Code code:codeList){
            codes.addElement(code);
        }
        return codes;
    }
    
    public Vector<ClientUser> getClientNameList() {
        Vector<ClientUser> clients = new Vector<ClientUser>();
        List<ClientUser> clientList = collectionservice.getClientNameList();
        for(ClientUser client:clientList){
            clients.addElement(client);
            
        }
        return clients;
    }
    
     public Vector<Employee> getDriversList() {
        Vector drivers = new Vector();
        List<Employee> driverList = collectionservice.getEmployeeNameList();
        for(Employee driver:driverList){
            Employee tempDriver = new Employee();
            tempDriver.setId(driver.getId());
            tempDriver.setEmployee_Name(driver.getEmployee_Name());
            drivers.addElement(tempDriver);
        }
        return drivers;
    }
     
     /*public Vector<Vector<String>> getClientNameLists(){
         return clientservice.getClientNameLists();
     }
     
     public Vector<Vector<String>> getEmployeeNameLists(){
         return employeeService.getEmployeeNameLists();
     }*/
     public Vector<Vector<String>> getSearchResults(ClientCollectionSearchDTO search){
         List<ClientCollection> clientcollectionlist = collectionservice.getSearchResult(search);
          Vector<Vector<String>> returnList = new Vector<Vector<String>>();
         
           for(ClientCollection record:clientcollectionlist){
              Code code = new Code();
              Vector<String> clientcollection = new Vector<String>();
              clientcollection.add(String.valueOf(record.getId()));
              clientcollection.add(String.valueOf(sdf.format(record.getPayment_date())));
              code=codeService.getCodeName(record.getCollection_type_id()!=null?record.getCollection_type_id():0);
              if(code!=null){
                  clientcollection.add(code.getName());
              }
              //clientcollection.add(record.getClient().getVehicleOwner().getOwnername());
              clientcollection.add(record.getEmployee().getEmployee_Name());
              if(record.getDiposited_at()!=null){
              clientcollection.add(String.valueOf(record.getDiposited_at()));
              }else{
                  clientcollection.add("");
              }
              clientcollection.add(String.valueOf(record.getAmount()));
              returnList.add(clientcollection);
              }
               return returnList;
          }
     public ClientCollection getClientCollectionDetails(Long valueOf) {
        return collectionservice.getClientCollectionDetails(valueOf);
    }

    public void deleteClientTransaction(Long clientId) {
        collectionservice.deleteTransaction(clientId);
    }

    public Vector<ClientUser> getAllClientList() {
        Vector<ClientUser> clients = new Vector<ClientUser>();
        List<ClientUser> clientList = jeservice.getAllClientNameList();
        for(ClientUser client:clientList){
            clients.addElement(client);
            
        }
        return clients;
    }

    public CollectionCalcu getPayment(Long clientId) {
        return collectionservice.getPayment(clientId);
    }
    
    
    
}


Commits for TransPort_Tracking/TransPortTracking/src/main/java/com/bestray/transtracking/controller/ClientCollectionController.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Sat 28 Jul, 2018 05:29:14 +0000