Commit 8aaba4fc by TongZuu

init TABean PPTV

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/j2ee.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/dynamicjava.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/jdom.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/bsh-1.3b2.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/jar/commons/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/MynoteBean.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/OTPrivilege.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/Databean.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/CSCFrameWork.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/NDWR.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/dwr.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/jakarta-regexp-1.2.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/PRBean.jar"/>
<classpathentry kind="lib" path="D:/EnterprisePT/Programmer/myHRAppServer/webapps/PPTV/hrAppWeb.war/WEB-INF/lib/UTBean.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TABean</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.ide.eclipse.jdt.aop.core.AopProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.jboss.ide.eclipse.jdt.aop.core.AopProjectNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Manifest-Version: 1.0
/*
* Created on 23 .. 2549
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.cscexport;
import com.csc.library.utilities.MyLog;
import java.util.Properties;
import org.apache.log4j.Logger;
import com.csc.library.cscexport.ExportXml;
import com.csc.library.cscexport.MyExport;
import com.csc.library.cscexport.TransferEmployeeToBank;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialEnvironment;
import com.csc.library.utilities.DbXml;
import com.csc.library.utilities.UProfile;
/**
* @author SassyBoy100
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ExportSwipeCard extends MyExport {
final static private Logger logger = Logger.getLogger(TransferEmployeeToBank.class);
public ExportSwipeCard() {
}
/**
* <PRE>
* Overide ʹ process
* ͵Ǩͺ ͹зӡ export
* </PRE>
* @see com.csc.library.cscexport.MyExport#process(String)
*/
public boolean process(String conid) throws Exception {
this.initValue(conid);
// new writefile for write text main process
DbInquiry inq = this.getDbInq();
String filter = inq.getFilter();
MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SCREEN FILTER IS:" + filter + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
this.setExpXml(new ExportXml(new InitialEnvironment("GLOBAL").getValue("export-dir") + "REPORT/EXPORT/XML/" +this.getCondition().get("SCREEN").toString()));
if (this.getExpXml().getRequiryFound()!=null){
if (this.getExpXml().getRequiryFound().equalsIgnoreCase("true")){
inq.setRequiredFound(true);
}
}
inq.refresh();
this.setDbInq(inq);
this.setExportFile(conid+ "." + this.getExpXml().getFileType()); // follow by report id
this.setOutFile(this.getExportPath() + this.getExportFile());
return this.process();
}
/**
* @see com.csc.library.cscexport.MyExport#initValue(String)
*/
protected boolean initValue(String conid) {
try {
this.setConid(conid);
MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!! PARAM BEFORE EXPORT IS:" + this.getCondition() + "!!!!!!!!!!!!!!!!!!!!!!!");
this.setUp((UProfile) this.getCondition().get("UPROFILE"));
this.setFilter((Properties) this.getCondition().get("FILTER"));
this.setDbInq(new DbXml(this.getUp(), (String) this.getCondition().get("SCREEN"), "", "", "").getInquiry());
this.setInquiryFilter();
this.setExportPath(new InitialEnvironment("GLOBAL").getValue("exportglfile-dir"));
this.setOutFile(this.getExportPath() + this.getExportFile());
return true;
} catch (Exception e) {
MyLog.error(this, e);
return false;
}
}
}
/*
* Created on 23 .. 2549
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.cscexport;
import com.csc.library.utilities.MyLog;
import java.util.Properties;
import org.apache.log4j.Logger;
import com.csc.library.cscexport.ExportXml;
import com.csc.library.cscexport.MyExport;
import com.csc.library.cscexport.TransferEmployeeToBank;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialEnvironment;
import com.csc.library.utilities.DbXml;
import com.csc.library.utilities.UProfile;
/**
* @author SassyBoy100
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ExportTAData extends MyExport {
final static private Logger logger = Logger.getLogger(TransferEmployeeToBank.class);
public ExportTAData() {
}
/**
* <PRE>
* Overide ʹ process
* ͵Ǩͺ ͹зӡ export
* </PRE>
* @see com.csc.library.cscexport.MyExport#process(String)
*/
public boolean process(String conid) throws Exception {
this.initValue(conid);
// new writefile for write text main process
DbInquiry inq = this.getDbInq();
String filter = inq.getFilter();
MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SCREEN FILTER IS:" + filter + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
String exportDir = new InitialEnvironment("GLOBAL").getValue("export-dir");
this.setExpXml(new ExportXml(exportDir + "REPORT/EXPORT/XML/" +this.getCondition().get("SCREEN").toString()));
if (this.getExpXml().getRequiryFound()!=null){
if (this.getExpXml().getRequiryFound().equalsIgnoreCase("true")){
inq.setRequiredFound(true);
}
}
inq.refresh();
this.setDbInq(inq);
this.setExportFile(conid+ "." + this.getExpXml().getFileType()); // follow by report id
String appName = (String) this.getUp().get("appname");
this.setOutFile(exportDir+"/"+appName+"/REPORT/" + this.getExportFile());
return super.process();
}
/**
* @see com.csc.library.cscexport.MyExport#initValue(String)
*/
protected boolean initValue(String conid) {
try {
this.setConid(conid);
MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!! PARAM BEFORE EXPORT IS:" + this.getCondition() + "!!!!!!!!!!!!!!!!!!!!!!!");
this.setUp((UProfile) this.getCondition().get("UPROFILE"));
this.setFilter((Properties) this.getCondition().get("FILTER"));
this.setDbInq(new DbXml(this.getUp(), (String) this.getCondition().get("SCREEN"), "", "", "", this.condition).getInquiry());
this.setInquiryFilter();
this.setExportPath(new InitialEnvironment("GLOBAL").getValue("exportglfile-dir"));
this.setOutFile(this.getExportPath() + this.getExportFile());
return true;
} catch (Exception e) {
MyLog.error(this, e);
return false;
}
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.text.DecimalFormat;
import java.util.Iterator;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyTreeMap;
public class Dailyattendance_ot extends Memployee {
MyTreeMap hm_ta = new MyTreeMap(); //红ѹӧҹ
MyTreeMap hm_value = new MyTreeMap();
CscCalendar csStart = new CscCalendar();
CscCalendar csEnd = new CscCalendar();
MyHashMap hm_hol = new MyHashMap(); //红ѹشġ
/*
* ҧ field Ѻ Hash
* getString դ ʴ "" ᷹͡
*/
private void initialColumn() {
for (int i=1; i<=40; i++) {
for (int j=1; j<=11; j++) {
this.hm_value.put("col"+i+"_"+j,"");
}
for (int k=5; k<=10; k++) {
this.hm_value.put("col"+i+"_"+k+"h","");
}
}
}
/*
* param ҡ˹ҨѹͧҢš÷ӧҹ
* ˹ҨѺ Month Year
*/
private void setCalendar() {
MyLog.debug(this, "CODEID==="+this.param.get("CODEID"));
MyLog.debug(this, "MONTH==="+this.param.get("MONTH"));
MyLog.debug(this, "YEAR==="+this.param.get("YEAR"));
this.csStart = new CscCalendar((String)this.param.get("YEAR")+"-"
+(String)this.param.get("MONTH")+"-01");
this.csEnd = new CscCalendar((String)this.param.get("YEAR")+"-"
+(String)this.param.get("MONTH")+"-"+csStart.getDayInMonth());
}
/*
* 纤ҵҧ ͧ÷ӧҹ 1 record ŧ MyHashMap
* ͹㹵͹ save
*/
private MyHashMap getEmpData(Simttime_current12 rec) {
MyHashMap prop = new MyHashMap();
try {
prop.put("dateid",rec.getString("dateid"));
prop.put("m_tm_bg",rec.getString("m_tm_bg"));
prop.put("m_tm_en",rec.getString("m_tm_en"));
prop.put("time0id",rec.getString("time0id"));
prop.put("tr_type",rec.getString("ty_type"));
prop.put("eventgrp",rec.getString("eventgrp"));
prop.put("lt",rec.getString("lt"));
prop.put("col01",rec.getString("col01"));
prop.put("col02",rec.getString("col02"));
prop.put("col03",rec.getString("col03"));
prop.put("col04",rec.getString("col04"));
prop.put("data01",rec.getString("data01"));
prop.put("data02",rec.getString("data02"));
prop.put("data03",rec.getString("data03"));
prop.put("data04",rec.getString("data04"));
prop.put("dataEtc",rec.getString("dataEtc"));
} catch (Exception e) {
MyLog.error(this, e);
}
return prop;
}
/*
* 红š÷ӧҹ/ ŧ MyHashMap hm_ta
* ͹硡Ѻѹ͹͡ çѺš÷ӧҹ
*/
private void initialEmpWorkingTime() {
try {
String sql="employeeid='"+this.getString("employeeid")+"' and " +
"(dateid between '"+this.csStart.getYYYYMMDD()+"' and '"+this.csEnd.getYYYYMMDD()+"')";
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setParam(this.param);
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("ttime_current1", sql, "");
inq.setColumn("*");
inq.refresh();
int i=1;
String tmp="";
while (inq.next()) {
MyTreeMap tr;
Simttime_current12 rec = (Simttime_current12) inq.getCurrentDbRecord();
CscCalendar csc = new CscCalendar(rec.getString("dateid"));
if (csc.getYYYYMMDD().equals(tmp)) {
tr = (MyTreeMap) this.hm_ta.get(csc.getYYYYMMDD());
} else {
i=1;
tr = new MyTreeMap();
}
tr.put(String.valueOf(i), this.getEmpData(rec));
this.hm_ta.put(csc.getYYYYMMDD(), tr);
i++;
tmp = csc.getYYYYMMDD();
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
/*
* Ӣš÷ӧҹ hm_ta ѹ͡Ҩҡ˹Ҩ
* ҡѹçѹ put š÷ӧҹŧ hm_value
* ҡçѹ put ѹŧ hm_value
*/
private void mapWorkingData() {
DecimalFormat df = new DecimalFormat();
CscCalendar dateStart = new CscCalendar(this.csStart.getYYYYMMDD());
CscCalendar dateEnd = new CscCalendar(this.csEnd.getYYYYMMDD());
int i=1;
while (dateStart.beforeEqualsDate(dateEnd)) {
if (this.hm_ta.containsKey(dateStart.getYYYYMMDD())) {
/*
* բš÷ӧҹ put š÷ӧҹ͡
* ŧ MyHashMap hm_value
*/
MyTreeMap tr = (MyTreeMap) this.hm_ta.get(dateStart.getYYYYMMDD());
Iterator it = tr.keySet().iterator();
while (it.hasNext()) {
String code = (String) it.next();
try {
MyHashMap hRec = (MyHashMap) tr.get(code);
this.hm_value.put("col"+i+"_1", dateStart.getDDMMYYYY());
this.hm_value.put("col"+i+"_2", hRec.getString("time0id"));
if (hRec.getString("m_tm_bg").equals(hRec.getString("m_tm_en"))) {
this.hm_value.put("col"+i+"_3", "");
this.hm_value.put("col"+i+"_4", "");
} else if (hRec.getString("tr_type").indexOf("A")>-1) {
this.hm_value.put("col"+i+"_3", df.format(hRec.getDouble("c_tm_bg")));
this.hm_value.put("col"+i+"_4", df.format(hRec.getDouble("c_tm_en")));
} else {
this.hm_value.put("col"+i+"_3", df.format(hRec.getDouble("m_tm_bg")));
this.hm_value.put("col"+i+"_4", df.format(hRec.getDouble("m_tm_en")));
}
this.hm_value.put("col"+i+"_5", hRec.getString("lt"));
this.hm_value.put("col"+i+"_6", hRec.getString("data01"));
this.hm_value.put("col"+i+"_7" ,hRec.getString("data02"));
this.hm_value.put("col"+i+"_8", hRec.getString("data03"));
this.hm_value.put("col"+i+"_9", hRec.getString("data04"));
this.hm_value.put("col"+i+"_10", hRec.getString("dataEtc"));
this.hm_value.put("col"+i+"_11", this.chkDayType(dateStart.getYYYYMMDD(), dateStart.getCSCDOW())); //ͧѹ
/*
* col 5h-10h put column ŧ
*/
this.hm_value.put("col"+i+"_5h", "");
this.hm_value.put("col"+i+"_6h", hRec.getString("col01"));
this.hm_value.put("col"+i+"_7h" ,hRec.getString("col02"));
this.hm_value.put("col"+i+"_8h", hRec.getString("col03"));
this.hm_value.put("col"+i+"_9h", hRec.getString("col04"));
this.hm_value.put("col"+i+"_10h", "");
} catch (Exception e) {
MyLog.error(this, e);
}
i++;
}
} else {
/*
* բš÷ӧҹ put ѹ
* ŧ MyHashMap hm_value
* ǹͧ ""
*/
MyLog.debug(this, "::: NOT MAP ::: "+dateStart.getDDMMYYYY());
this.hm_value.put("col"+i+"_1", dateStart.getDDMMYYYY());
this.hm_value.put("col"+i+"_11", this.chkDayType(dateStart.getYYYYMMDD(), dateStart.getCSCDOW())); //ͧѹ
i++;
}
dateStart.incDate();
}
}
/*
* չӧҹѹ
* I = ѹشġ
* * = ѹش -
* Y = ѹӧҹ
*/
private String chkDayType(String date ,int type) {
if (this.hm_hol.containsKey(date)) {
return "I";
} else if (type==6 || type==7) {
return "*";
}
return "";
}
/*
* ŴѹشġͧФ MyHashMap
* ͹ѹӧҹѹشġ
*/
private void setHoliday() {
try {
DbInquiry inqChild = new InitialInquiry(this.userPro).getDbInquiry();
inqChild.setParam(this.param);
inqChild.setSchemaName(this.userPro.getSchemaName());
inqChild.initMyTable("Mholiday1", "", "");
inqChild.setColumn("holidayid, hdate");
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setParam(this.param);
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0", "time0id='"+this.getString("time0")+"'", "");
inq.setColumn("time0id, companyid, holidaycode");
inq.putChild(inqChild);
inq.refresh();
if (inq.next()) {
DbInquiry child = (DbInquiry) inq.getChild("Mholiday1");
do {
CscCalendar cs = new CscCalendar(inqChild.getCurrentDbRecord().getString("hdate"));
this.hm_hol.put(cs.getYYYYMMDD(), cs.getYYYYMMDD());
} while (child.next());
}
} catch(Exception e) {
MyLog.error(this, e);
}
}
public void postInqNext() {
if (this.foundData) {
super.postInqNext();
this.initialColumn();
this.setCalendar();
this.setHoliday();
this.initialEmpWorkingTime();
this.mapWorkingData();
MyLog.debug(this, this.hm_ta.toString());
MyLog.debug(this, this.hm_value.toString());
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") >= 0) {
return this.getStringHash(fieldName);
} else if (this.hm_value.containsKey(fieldName)) {
return this.hm_value.get(fieldName).toString();
} else return super.getString(fieldName);
}
private String getStringHash(String fieldName) {
if (fieldName.indexOf("$") >= 0) {
String fname = fieldName.substring(0, fieldName.indexOf("$"));
String lname = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hm_value.containsKey(lname)) {
return (String) this.hm_value.get(lname);
} else return super.getString(fieldName);
} else return super.getString(fieldName);
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
import com.csc.library.utilities.MyLog;
public class Emp_create_list extends RecordCmp {
public Emp_create_list() {
super("Emp_create_list", "Emp_create_list Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
import com.csc.library.utilities.MyLog;
public class Emp_create_list_temp extends RecordCmp {
public Emp_create_list_temp() {
super("Emp_create_list_temp", "Emp_create_list_temp Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Empwork_avg extends RecordCmp{
public Empwork_avg() {
super("Empwork_avg", "Empwork_avg Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Empwork_rslt extends RecordCmp{
public Empwork_rslt(){
super("Empwork_rslt", "Empwork_rslt Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Empwork_year extends RecordCmp{
public Empwork_year() {
super("Empwork_year", "Empwork_year Table");
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
import com.csc.library.utilities.MyTreeMap;
/*
* class Ѻ͡§ҹ ʶԵԨӹǹ¢ͧѡҹ
*/
public class Latesummary extends Memployee {
MyTreeMap hm_value = new MyTreeMap();
CscCalendar csStart = new CscCalendar();
CscCalendar csEnd = new CscCalendar();
DbInquiry inqTime = null;
DbInquiry inqHistory = null;
public void postInqNext() {
if (this.foundData) {
super.postInqNext();
this.initialColumn();
this.setCalendar();
this.initialEmpWorkingTime();
System.out.println(this.hm_value);
}
}
/*
* ˹§ҹ ӹǹ 12 ͹
*/
private void initialColumn() {
for (int i=1; i<=12; i++) {
this.hm_value.put("col"+i, new Integer(0));;
this.hm_value.put("month"+i, "");;
}
}
/*
* ӡá˹ӹǹ͹ͧ͡§ҹ
* ·ӡúǡӹǹ͹ѺҨҡ˹Ҩա 11 ͹
* 12 ͹
*/
private void setCalendar() {
MyLog.debug(this, "START MONTH==="+this.param.get("MONTH_START"));
MyLog.debug(this, "START YEAR==="+this.param.get("YEAR_START"));
MyLog.debug(this, "END MONTH==="+this.param.get("MONTH_END"));
MyLog.debug(this, "END YEAR==="+this.param.get("YEAR_END"));
this.csStart = new CscCalendar((String)this.param.get("YEAR_START")+"-"
+(String)this.param.get("MONTH_START")+"-01");
CscCalendar cs = new CscCalendar((String)this.param.get("YEAR_END")+"-"
+(String)this.param.get("MONTH_END")+"-01");
this.csEnd = new CscCalendar((String)this.param.get("YEAR_END")+"-"
+(String)this.param.get("MONTH_END")+"-"+cs.getEndDateOfMonth());
CscCalendar c1 = new CscCalendar(csStart.getDDMMYYYY());
CscCalendar c2 = new CscCalendar(csEnd.getDDMMYYYY());
int loop = 1;
int i = 1 ;
CscCalendar tmp = null;
while (c1.beforeDate(c2)) {
if (loop==1) {
tmp = new CscCalendar(c1.getDDMMYYYY());
this.hm_value.put((c1.getMM()+":"+c1.getYear()), "header"+i);
if (this.userPro.get("lang").equalsIgnoreCase("tha")) {
this.hm_value.put("month"+i, c1.getThaiLongMonth()+" "+c1.getYear());
} else this.hm_value.put("month"+i, c1.getEngLongMonth()+" "+c1.getYear());
i++;
}
//System.out.println("tmp : "+tmp.getMonth()+" : "+tmp.getYear());
//System.out.println("c1 : "+c1.getMonth()+" : "+c1.getYear());
if (tmp.getMonth()!=c1.getMonth() || tmp.getYear()!=c1.getYear()) {
this.hm_value.put((c1.getMM()+":"+c1.getYear()), "header"+i);
i++;
if (this.userPro.get("lang").equalsIgnoreCase("tha")) {
this.hm_value.put("month"+i, c1.getThaiLongMonth()+" "+c1.getYear());
} else this.hm_value.put("month"+i, c1.getEngLongMonth()+" "+c1.getYear());
}
c1.incMonth(1);
loop++;
}
}
/*
* ӡúǡӹǹ边ѡҹ
* ӹǹ 12 ͹˹ҧ
* Ҩҡ ttime_current1 = 㹧ǴѨغѹ
* ttime_history1 = 㹻ѵԡ÷ӧҹ
*/
private void initialEmpWorkingTime() {
try {
String filter="employeeid='"+this.getString("employeeid")+"' and " +
"(dateid between '"+this.csStart.getYYYYMMDD()+"' and '"+this.csEnd.getYYYYMMDD()+"') " +
"and lt>0";
//ǴѨغѹ
if (this.inqTime == null) {
this.inqTime = new InitialInquiry(this.userPro).getDbInquiry();
this.inqTime.setParam(this.param);
this.inqTime.setSchemaName(this.userPro.getSchemaName());
this.inqTime.initMyTable("Ttime_current1", "", "employeeid, dateid");
this.inqTime.setColumn("*");
}
this.inqTime.setFilter(filter);
this.inqTime.refresh();
while (this.inqTime.next()) {
System.out.println("DATE : "+this.inqTime.getCurrentDbRecord().getString("dateid"));
CscCalendar cs = new CscCalendar(this.inqTime.getString("dateid"));
if (this.hm_value.containsKey(cs.getMM()+":"+cs.getYear())) {
String header = (String) this.hm_value.get(cs.getMM()+":"+cs.getYear());
String id = header.substring(6, header.length());
int value = ((Integer) this.hm_value.get("col"+id)).intValue() + 1;
this.hm_value.put("col"+id, Integer.valueOf(value));
}
}
//㹻ѵԡá÷ӧҹ
if (this.inqHistory == null) {
this.inqHistory = new InitialInquiry(this.userPro).getDbInquiry();
this.inqHistory.setParam(this.param);
this.inqHistory.setSchemaName(this.userPro.getSchemaName());
this.inqHistory.initMyTable("Ttime_history1", "", "employeeid, dateid");
this.inqHistory.setColumn("*");
}
this.inqHistory.setFilter(filter);
this.inqHistory.refresh();
while (this.inqHistory.next()) {
System.out.println("DATE HISTORY : "+this.inqHistory.getCurrentDbRecord().getString("dateid"));
CscCalendar cs = new CscCalendar(this.inqHistory.getString("dateid"));
if (this.hm_value.containsKey(cs.getMM()+":"+cs.getYear())) {
String header = (String) this.hm_value.get(cs.getMM()+":"+cs.getYear());
String id = header.substring(6, header.length());
int value = ((Integer) this.hm_value.get("col"+id)).intValue() + 1;
this.hm_value.put("col"+id, Integer.valueOf(value));
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Lvprvlgstock extends RecordCmp{
public Lvprvlgstock() {
super("Lvprvlgstock", "Lvprvlgstock Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus extends RecordCmp{
public Mbus() {
super("Mbus","Mbus Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_company extends RecordCmp{
public Mbus_company() {
super("Mbus_company", "Mbus_company Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_emp0 extends RecordCmp {
public Mbus_emp0() {
super("Mbus_emp0", "Mbus_emp0 Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_emp1 extends RecordCmp {
public Mbus_emp1() {
super("Mbus_emp1", "Mbus_emp1 Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_employee extends RecordCmp{
public Mbus_employee() {
super("Mbus_employee", "Mbus_employee Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_late0 extends RecordCmp{
public Mbus_late0() {
super("Mbus_late0", "Mbus_late0 Table");
}
}
package com.csc.library.databean;
import java.util.Iterator;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.session.RecordCmp;
import com.csc.library.timeattendance.DayShift;
import com.csc.library.timeattendance.Shift;
import com.csc.library.timeattendance.WorkingShift;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
public class Mbus_late1 extends RecordCmp{
private DbRecord rec = null;
private DbInquiry inqEmp = null;
private DbInquiry inqTime = null;
private DbInquiry inqTemp = null;
public Mbus_late1() {
super("Mbus_late1", "Mbus_late1 Table");
}
protected void postInsertTrigger() throws Exception {
super.postInsertTrigger();
//this.saveTimeData();
}
protected void postUpdateTrigger() throws Exception {
super.postInsertTrigger();
//this.deleteTimeData();
//this.saveTimeData();
}
protected void postDeleteTrigger() throws Exception {
super.postDeleteTrigger();
//this.deleteTimeData();
}
private CscCalendar getWorkingDateTime() {
try {
CscCalendar csc = new CscCalendar(this.getString("datelate"));
if (this.inqEmp == null) {
this.inqEmp = new InitialInquiry(this.userPro).getDbInquiry();
this.inqEmp.setParam(this.param);
this.inqEmp.setSchemaName(this.userPro.getSchemaName());
this.inqEmp.initMyTable("Memployee", "", "");
this.inqEmp.setColumn("employeeid, runno, emp_position, emp_group, branch, job, bossid, emp_level, workarea," +
"bu1, bu2, bu3, bu4, bu5, costcenter, salatype, currency, salary, emp_every, time0, companyid, status, startdate, resigndate");
}
this.inqEmp.setFilter("employeeid='"+this.getString("employeeid")+"'");
this.inqEmp.refresh();
while (this.inqEmp.next()) {
DbRecord empRec = this.inqEmp.getCurrentDbRecord();
Mtime0 timeRec = null;
if (this.inqTime == null) {
this.inqTime = new InitialInquiry(this.userPro).getDbInquiry();
this.inqTime.setParam(this.param);
this.inqTime.setSchemaName(this.userPro.getSchemaName());
this.inqTime.initMyTable("Mtime0", "", "");
this.inqTime.setColumn("*");
}
this.inqTime.setFilter("time0id='" + empRec.getString("time0") + "'");
this.inqTime.refresh();
while (this.inqTime.next()) {
timeRec = (Mtime0) this.inqTime.getCurrentDbRecord();
}
timeRec.setEmpRec(empRec);
CscCalendar cs1 = new CscCalendar(this.getString("datelate"));
cs1.decDate();
CscCalendar cs2 = new CscCalendar(this.getString("datelate"));
cs2.incDate();
WorkingShift ws = timeRec.genWorkingShift(new CscCalendar(cs1 .getTimestamp()), new CscCalendar(cs2.getTimestamp()), "true");
ws.setUProfile(this.userPro);
ws.setEmployeeid(empRec.getString("employeeid"));
//ws.adjust();
MyLog.debug("Working Shift of :> "+empRec.getString("employeeid"));
MyLog.debug(ws.toString());
Iterator it = ws.keySet().iterator();
while (it.hasNext()) {
String code = (String) it.next();
DayShift ds = (DayShift) ws.get(code);
Iterator it2 = ds.keySet().iterator();
while (it2.hasNext()) {
String code2 = (String) it2.next();
Shift sh = (Shift) ds.get(code2);
if (csc.equalsDate(sh.get_c_dt_in())) {
return sh.get_c_dt_in();
}
}
}
}
} catch (Exception e) {
MyLog.error(this, e);
return null;
}
return null;
}
private void saveTimeData() {
try {
CscCalendar csc = this.getWorkingDateTime();
if (csc!=null) {
if (this.rec == null) {
this.rec = new InitialRecord(this.userPro).getDbRecord("TTIMETEMP");
}
this.rec.clearField();
this.rec.set("EMPLOYEEID", this.getString("employeeid"));
this.rec.set("COMPANYID", (String) this.userPro.get("companyid"));
this.rec.set("SWIPEDATE", csc.getYYYYMMDD());
this.rec.set("SWIPETIME", csc.getCSCTime());
this.rec.set("SOURCE", "6");
this.rec.save();
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void deleteTimeData() {
try {
if (this.inqTemp == null) {
this.inqTemp = new InitialInquiry(this.userPro).getDbInquiry();
this.inqTemp.setParam(this.param);
this.inqTemp.setSchemaName(this.userPro.getSchemaName());
this.inqTemp.initMyTable("Ttimetemp", "", "");
this.inqTemp.setColumn("*");
}
CscCalendar csc = new CscCalendar(this.pRemote.getString("datelate"));
this.inqTemp.setFilter("employeeid='" + this.pRemote.getString("employeeid") + "' " +
"and swipedate='"+csc.getYYYYMMDD()+"' and source='6'");
this.inqTemp.refresh();
while (this.inqTemp.next()) {
DbRecord recTemp = this.inqTemp.getCurrentDbRecord().cloneRecord(true);
recTemp.delete();
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mbus_station extends RecordCmp{
public Mbus_station() {
super("Mbus_station", "Mbus_station");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mcardtemp extends RecordCmp implements DbRecord {
public Mcardtemp() {
super("Mcardtemp","Mcardtemp Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mcardtemp_cause extends RecordCmp implements DbRecord{
public Mcardtemp_cause() {
super("Mcardtemp_cause","Mcardtemp_cause Table");
}
}
package com.csc.library.databean;
/**
* @author paecsc
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Mconfigta extends Simmconfig {
public Mconfigta() {
super("TA_CONFIG",true);
}
/*public int insert() {
this.setVerifyOff();
return super.insert();
}*/
}
\ No newline at end of file
/*
* Created on 24 ¡.¾. 2549
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.RecordCmp;
/**
* @author SassyBoy100
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Mdocument_formula extends RecordCmp{
public Mdocument_formula() {
super("Mdocument_formula", "Document Formula Table");
}
}
/*
* Created on 20 .. 2548
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.session.RecordCmp;
/**
* @author vassana
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
* class Ѻ红šѵêǤǢͧѡҹ
*/
public class Mempl_cardtemp extends RecordCmp implements DbRecord{
public Mempl_cardtemp() {
super("Mempl_cardtemp", "Mempl_cardtemp Table");
}
protected void postInsertTrigger() throws Exception {
super.postInsertTrigger();
this.saveData();
}
protected void postUpdateTrigger() throws Exception {
super.postUpdateTrigger();
this.deleteData();
this.saveData();
}
protected void postDeleteTrigger() throws Exception {
super.postDeleteTrigger();
this.deleteData();
}
/*
* ӡúѹ֡šѵêǤǢͧѡҹ ŧ价ѹ
* ͨй㹡äӹdz͹ ͹(Transfer)
*/
private void saveData() {
DbRecord rec = new InitialRecord(this.userPro).getDbRecord("Mempl_cardtemp1");
try {
CscCalendar c1 = new CscCalendar(this.getString("startdate"));
CscCalendar c2 = new CscCalendar(this.getString("enddate"));
rec.clearField();
while (c1.beforeEqualsDate(c2)) {
rec.set("employeeid", this.getString("employeeid"));
rec.set("companyid", (String) this.userPro.get("companyid"));
rec.set("swipecardid", this.getString("swipecardid"));
rec.set("dateid", c1.getYYYYMMDD());
rec.save();
c1.incDate();
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
/*
* źšѵêǤǢͧѡҹ
*/
private void deleteData() {
try {
CscCalendar c1 = new CscCalendar(this.pRemote.getString("startdate"));
CscCalendar c2 = new CscCalendar(this.pRemote.getString("enddate"));
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.initMyTable("Mempl_cardtemp1", "", "");
inq.setColumn("*");
inq.setFilter("swipecardid='"+this.pRemote.getString("swipedateid")+"' " +
"and employeeid='"+this.pRemote.getString("employeeid")+"' " +
"and (dateid between '"+c1.getYYYYMMDD()+"' and '"+c2.getYYYYMMDD()+"')");
inq.refresh();
while (inq.next()) {
DbRecord rec = inq.getCurrentDbRecord().cloneRecord(true);
rec.delete();
} while (inq.next());
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
package com.csc.library.databean;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mempl_cardtemp1 extends RecordCmp implements DbRecord{
public Mempl_cardtemp1() {
super("Mempl_cardtemp1", "Mempl_cardtemp1 Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.database.StaticConfig;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
/*
* 㹡ʴӹǹ边ѡҹͺ 1
* Ѻʡ Ҩҡ˹Ҩ
*/
public class Mempl_late_yearsummary extends Memployee {
MyHashMap hmDataMonth = new MyHashMap();
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
this.initDataColunm(this.hmDataMonth);
this.setData();
MyLog.debug(this, "MONTH DATA==="+this.hmDataMonth);
}
return temp;
}
/*
* ˹͹
*/
private void initDataColunm(MyHashMap hm) {
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
int m = Integer.parseInt(cscStart.getMM());
int i=1;
while (i<=12) {
String id = String.valueOf(i);
CscCalendar csc = new CscCalendar("01-"+id+"-"+cscStart.getYear());
this.hmDataMonth.put("col"+id+"_name",csc.getEngShortMonth());
if (this.getUProfile().get("lang").equals("THA")){
this.hmDataMonth.put("col"+id+"_name",csc.getThaiShortMonth());
}
this.hmDataMonth.put("col"+id+"_used",new Double(0));
this.hmDataMonth.put("col"+id+"_count",new Integer(0));
i++;
}
this.hmDataMonth.put("used_total",new Double(0));
this.hmDataMonth.put("count_total",new Integer(0));
}
/*
* ӡúǡӹǹ边ѡҹ ¡͹ӹǹ 1
* Ѻʡ Ҩҡ˹Ҩ
* ҢҨҡ Mempl_leave_total
*/
private void setData() {
try {
/*
* DayType = 7 Vacation
* DayType = LT Late
* DayType other Leave
*/
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
String leave = (String) this.param.get("LEAVETYPE");
//CscCalendar cscLeaveStart = new CscCalendar(StaticConfig.getConfigCompany(this.userPro, "ta1001"));
//CscCalendar cscLeaveEnd = new CscCalendar(StaticConfig.getConfigCompany(this.userPro, "ta1002"));
String filter = "employeeid='"+this.getString("employeeid")+"'" +
" and ((monthid>="+Integer.parseInt(cscStart.getMM())+" " +
" and yearid>="+cscStart.getYear()+") " +
" or (monthid<="+Integer.parseInt(cscEnd.getMM())+" " +
" and yearid<="+cscEnd.getYear()+"))" +
" and day_type='"+leave+"'";
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mempl_leave_total", filter, "");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
DbRecord rec = inq.getCurrentDbRecord();
String id = "col"+rec.getInt("MONTHID");
if (this.hmDataMonth.containsKey(id+"_name")) {
int count = this.hmDataMonth.getInt(id+"_count");
float used = this.hmDataMonth.getFloat(id+"_used");
count = rec.getInt("DAY_COUNT") + count;
CscTime ct = new CscTime(used);
ct.add(rec.getFloat("DAY_USED"));
used = ct.getFloat();
this.hmDataMonth.put(id+"_used", new Float(used));
this.hmDataMonth.put(id+"_count", new Integer(count));
}
//ӡúǡ駻
int count_total = this.hmDataMonth.getInt("count_total");
float used_total = this.hmDataMonth.getFloat("used_total");
count_total = rec.getInt("DAY_COUNT") + count_total;
CscTime ct = new CscTime(used_total);
ct.add(rec.getFloat("DAY_USED"));
used_total = ct.getFloat();
this.hmDataMonth.put("count_total", new Integer(count_total));
this.hmDataMonth.put("used_total", new Float(used_total));
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hmDataMonth.get(fName) != null) {
return this.hmDataMonth.getString(fName);
} else super.getString(fieldName);
}
return super.getString(fieldName);
}
}
package com.csc.library.databean;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
import com.csc.library.utilities.MyLog;
/*
* 㹡ʴӹǹ边ѡҹͺ 1 բͧ Ƿ
*/
public class Mempl_late_yearsummary_nstda extends Memployee {
private MyHashMap hmDataMonth = new MyHashMap();
private DbInquiry inqC = null;
private DbInquiry inqH = null;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
this.initDataColunm(this.hmDataMonth);
this.setData();
MyLog.debug(this, "MONTH DATA==="+this.hmDataMonth);
}
return temp;
}
/*
* ˹͹
*/
private void initDataColunm(MyHashMap hm) {
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
int m = Integer.parseInt(cscStart.getMM());
int i=1;
while (i<=12) {
String id = String.valueOf(i);
CscCalendar csc = new CscCalendar("01-"+id+"-"+cscStart.getYear());
this.hmDataMonth.put("col"+id+"_name",csc.getEngShortMonth());
if (this.getUProfile().get("lang").equals("THA")){
this.hmDataMonth.put("col"+id+"_name",csc.getThaiShortMonth());
}
this.hmDataMonth.put("col"+id+"_used",new Double(0));
this.hmDataMonth.put("col"+id+"_count",new Integer(0));
i++;
}
this.hmDataMonth.put("used_total",new Double(0));
this.hmDataMonth.put("count_total",new Integer(0));
}
/*
* ӡúǡӹǹ边ѡҹ ¡͹ӹǹ 1
* ҢҨҡ ttime_current1 ttime_history1
*/
private void setData() {
/*
* DayType = 7 Vacation
* DayType = LT Late
* DayType other Leave
*/
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
String leave = (String) this.param.get("LEAVETYPE");
String filter = "employeeid='"+this.getString("employeeid")+"'" +
" and (dateid between '"+cscStart.getYYYYMMDD()+"' and '"+cscEnd.getYYYYMMDD()+"')" +
" and lt>0";
try {
//š÷ӧҹ㹻Ѩغѹ
if (this.inqC==null) {
this.inqC = new InitialInquiry(this.userPro).getDbInquiry();
this.inqC.setSchemaName(this.userPro.getSchemaName());
this.inqC.initMyTable("Ttime_current1", "", "employeeid,dateid");
this.inqC.setColumn("*");
}
this.inqC.setFilter(filter);
this.inqC.refresh();
while (this.inqC.next()) {
DbRecord rec = this.inqC.getCurrentDbRecord();
CscCalendar c = new CscCalendar(rec.getString("dateid"));
String id = "col"+Integer.parseInt(c.getMM());
if (this.hmDataMonth.containsKey(id+"_name")) {
int count = this.hmDataMonth.getInt(id+"_count");
float used = this.hmDataMonth.getFloat(id+"_used");
count = count+1;
CscTime ct = new CscTime(used);
ct.add(rec.getFloat("lt"));
used = ct.getFloat();
this.hmDataMonth.put(id+"_used", new Float(used));
this.hmDataMonth.put(id+"_count", new Integer(count));
}
//ӡúǡ駻
int count_total = this.hmDataMonth.getInt("count_total");
float used_total = this.hmDataMonth.getFloat("used_total");
count_total = count_total+1;
CscTime ct = new CscTime(used_total);
ct.add(rec.getFloat("lt"));
used_total = ct.getFloat();
this.hmDataMonth.put("count_total", new Integer(count_total));
this.hmDataMonth.put("used_total", new Float(used_total));
}
} catch (Exception e) {
MyLog.error(this, e);
}
try {
//š÷ӧҹ㹻ѵԡ÷ӧҹ
if (this.inqH==null) {
this.inqH = new InitialInquiry(this.userPro).getDbInquiry();
this.inqH.setSchemaName(this.userPro.getSchemaName());
this.inqH.initMyTable("Ttime_history1", "", "employeeid,dateid");
this.inqH.setColumn("*");
}
this.inqH.setFilter(filter);
this.inqH.refresh();
while (this.inqH.next()) {
DbRecord rec = this.inqH.getCurrentDbRecord();
CscCalendar c = new CscCalendar(rec.getString("dateid"));
String id = "col"+Integer.parseInt(c.getMM());
if (this.hmDataMonth.containsKey(id+"_name")) {
int count = this.hmDataMonth.getInt(id+"_count");
float used = this.hmDataMonth.getFloat(id+"_used");
count = count+1;
CscTime ct = new CscTime(used);
ct.add(rec.getFloat("lt"));
used = ct.getFloat();
this.hmDataMonth.put(id+"_used", new Float(used));
this.hmDataMonth.put(id+"_count", new Integer(count));
}
//ӡúǡ駻
int count_total = this.hmDataMonth.getInt("count_total");
float used_total = this.hmDataMonth.getFloat("used_total");
count_total = count_total+1;
CscTime ct = new CscTime(used_total);
ct.add(rec.getFloat("lt"));
used_total = ct.getFloat();
this.hmDataMonth.put("count_total", new Integer(count_total));
this.hmDataMonth.put("used_total", new Float(used_total));
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hmDataMonth.get(fName) != null) {
return this.hmDataMonth.getString(fName);
} else super.getString(fieldName);
}
return super.getString(fieldName);
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.RecordCmp;
public class Mempl_leave_total extends RecordCmp {
public Mempl_leave_total() {
super("Mempl_leave_total", "Mempl_leave_total Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
public class Mempl_leave_yearsummary extends Memployee {
MyHashMap hmLeave = new MyHashMap();
MyHashMap hmDataMonth = new MyHashMap();
private DbInquiry inqEvent = null;
private DbInquiry inqEmp =null;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
this.initLeaveColumn();
this.initDataColunm(this.hmDataMonth);
this.setData();
MyLog.debug(this, "HEAD DATA==="+this.hmLeave);
MyLog.debug(this, "MONTH DATA==="+this.hmDataMonth);
}
return temp;
}
/*
* 롭⌒찼沓뭅ㅸ腦촬窪들므脘죵뼙及윷한믹級첬友
* 穗쨈連죠ⓕ》及붐쨔뼙及윷한 (MEVENTGRP)
*/
private void setDayEventType(String id, String code) {
try {
if (this.inqEvent==null) {
this.inqEvent = new InitialInquiry(this.userPro).getDbInquiry();
this.inqEvent.setSchemaName(this.userPro.getSchemaName());
this.inqEvent.initMyTable("Meventgrp", "", "");
this.inqEvent.setColumn("*");
}
this.inqEvent.setFilter("eventgrpid='"+code+"'");
this.inqEvent.refresh();
if (this.inqEvent.next()) {
this.hmLeave.put(id+"_code", this.inqEvent.getString("eventgrpid"));
this.hmLeave.put(id+"_name", this.inqEvent.getString("tdesc"));
if (this.inqEvent.getString("daytype").equals("7")) {
this.hmLeave.put(id+"_limit", this.getString("vacation_total"));
} else this.hmLeave.put(id+"_limit", this.inqEvent.getString("limit"));
this.hmLeave.put(this.inqEvent.getString("eventgrpid"), id);
} else {
this.hmLeave.put(id+"_code", ""); //촉驥뼙及윷한
this.hmLeave.put(id+"_name", ""); //ぷ琓뼙及윷한
this.hmLeave.put(id+"_limit", ""); //ⓖ므뭍戾丞藕닻
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
/*
* 롭⌒찼沓뭅ㅸ腦촬窪들밤鉅촤짠拈 험賂듣털ㅝ턺졸移駱묏勒뼙及윷⌒쳔魯級
* 穗쨈溟納촉驥∴陌점櫓텀롱椀鰲죠ⓕ薑友ⓐ
*/
private void initLeaveColumn() {
if (this.param.containsKey("LEAVECOLUMN")) { //夕簾험納櫓褐㎴鎧伽텍窪⌒쳔 죠ⓕ¢백朗藁쵠琨쥡
String columnCode = (String) this.param.get("LEAVECOLUMN");
try {
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mleave_report", "codeid='"+columnCode+"'", "");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
DbRecord rec = inq.getCurrentDbRecord();
for (int i=1;i<=10;i++) {
String id = "col"+String.valueOf(i);
if (i<=9) {
id = "col0"+i;
}
this.setDayEventType(id, rec.getString(id));
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
/*
* ∂薑뇬脘煽逗졔埇試紆듣털ㅝ턺졸
*/
private void initDataColunm(MyHashMap hm) {
for (int i=1;i<=10;i++) {
String id = "col"+String.valueOf(i);
if (i<=9) {
id = "col0"+i;
}
int j=1;
while (j<=12) {
String mm = String.valueOf(j);
if (j<=9) {
mm = "0"+j;
}
hm.put(id+"_"+mm, new Float(0));
j++;
}
hm.put(id+"_total", new Float(0));
}
}
private void setData() {
try {
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
//CscCalendar cscStart = new CscCalendar("2005-01-01");
//CscCalendar cscEnd = new CscCalendar("2005-12-31");
String filter = "employeeid='"+this.getString("employeeid")+"'" +
" and ((monthid>="+Integer.parseInt(cscStart.getMM())+" " +
" and yearid>="+cscStart.getYear()+") " +
" or (monthid<="+Integer.parseInt(cscEnd.getMM())+" " +
" and yearid<="+cscEnd.getYear()+"))";
if (this.inqEmp==null) {
this.inqEmp = new InitialInquiry(this.userPro).getDbInquiry();
this.inqEmp.setSchemaName(this.userPro.getSchemaName());
this.inqEmp.initMyTable("Mempl_leave_total", "", "MONTHID,DAY_TYPE");
this.inqEmp.setColumn("*");
}
this.inqEmp.setFilter(filter);
this.inqEmp.refresh();
while (this.inqEmp.next()) {
DbRecord rec = this.inqEmp.getCurrentDbRecord();
if (this.hmLeave.containsKey(rec.getString("DAY_TYPE"))) { //夕簾험寧촛敾래櫓텀돤㎕紀ㅸ念戾睾撫尸∴陌점櫓텀롱蛙紀죠ⓕ¢백朗藁쵠琨潭
String col = this.hmLeave.getString(rec.getString("DAY_TYPE"));
String m = "";
if (rec.getInt("MONTH")<=9) {
m = "0"+ rec.getString("MONTHID");
} else m = rec.getString("MONTHID");
float lv = this.hmDataMonth.getFloat(col+"_"+m); //닛ℓ脘胥脘♨㎕櫓텀롱歪ㅒ뵉▽삔톱핏棨죠
CscTime ct = new CscTime(lv);
ct.add(rec.getFloat("DAY_USED")); //롭⌒첬퐈⌒쳔衲총蓼밌禹壘삑앝窪 穗쨘퐈先濚겊 60
this.hmDataMonth.put(col+"_"+m, new Float(ct.getFloat()));
float lv_total = this.hmDataMonth.getFloat(col+"_total"); //닛ℓ脘胥脘♨㎕櫓텀롤蓼個뉠戾西쨘퐈餓笑茸袴≠
CscTime ct_total = new CscTime(lv_total);
ct_total.add(rec.getFloat("DAY_USED")); //롭⌒첬퐈⌒쳔衲총蓼밌禹壘삑앝窪 穗쨘퐈先濚겊 60
this.hmDataMonth.put(col+"_total", new Float(ct_total.getFloat()));
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hmDataMonth.get(fName) != null) {
return this.hmDataMonth.getString(fName);
} else if (this.hmLeave.get(fName) != null) {
return this.hmLeave.getString(fName);
} else super.getString(fieldName);
}
return super.getString(fieldName);
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mempl_time0trans extends RecordCmp {
public Mempl_time0trans() {
super("Mempl_time0trans", "Mempl_time0trans Table");
}
}
package com.csc.library.databean;
import java.sql.SQLException;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialRecord;
import com.csc.library.session.RecordCmp0;
import com.csc.library.utilities.MyLog;
/*
* 红 Unused ҧ ͧѡҹ ͹ save ͹͹
* ¨й save field unused ͧ table ttime_current1
*/
public class Mempl_unused extends RecordCmp0 {
public Mempl_unused() {
super("Mempl_unused", "Mempl_unused Table");
}
@Override
protected void saveRecord() throws Exception {
if(this.param.get("__amountCheckBox")!=null){
this.saveOrUpDate();
}else{
super.saveRecord();
}
}
@Override
protected void updateRecord() throws SQLException {
if(this.param.get("__amountCheckBox")!=null){
this.saveOrUpDate();
}else{
super.updateRecord();
}
}
@Override
public boolean keyOK() {
// TODO Auto-generated method stub
String key = (String)this.param.get("__keyOk");
if(key!=null && key.equalsIgnoreCase("true")){
return true;
}
return super.keyOK();
}
private void saveOrUpDate(){
int amountCheckBox = Integer.parseInt(this.param.get("__amountCheckBox").toString());
String dataList[]=null;
String data = "";
String employeeid="";
String companyid="";
String dateid="";
String un2_value="";
String un2_doctype="";
String un2_docno="";
try{
DbRecord recUnused=new InitialRecord(this.getUProfile()).getDbRecord("Mempl_unused");
recUnused.setColumn("employeeid,companyid,dateid,un2_value,un2_doctype,un2_docno");
DbRecord recTtime1=new InitialRecord(this.getUProfile()).getDbRecord("Ttime_current1");
recTtime1.setColumn("employeeid,companyid,dateid,unused2");
for(int j=0;j<amountCheckBox;j++){
data=(String) this.param.get("__confirmOT"+j);
if(data!=null){
dataList = data.split("#");
try{
if(dataList.length==5){
employeeid = this.trimPipe(dataList[0]);
companyid = this.getUProfile().get("companyid");
dateid = this.trimPipe(dataList[1]);
un2_value = this.trimPipe(dataList[2]);
un2_doctype = this.trimPipe(dataList[3]);
un2_docno = this.trimPipe(dataList[4]);
//----Save Unused----//
recUnused.set("employeeid", employeeid);
recUnused.set("companyid", companyid);
recUnused.set("dateid", dateid);
recUnused.set("un2_value", un2_value);
recUnused.set("un2_doctype", un2_doctype);
recUnused.set("un2_docno", un2_docno);
recUnused.save();
//----Save Unused----//
//----Update Ttime_current1----//
recTtime1.set("employeeid", employeeid);
recTtime1.set("companyid", companyid);
recTtime1.set("dateid", dateid);
recTtime1.set("unused2", un2_value);
recTtime1.save();
//----Update Ttime_current1----//
}else{
MyLog.debug("aGa Say : Error in Mempl_unused.saveOrUpDate Cant get empid or dateid");
}
}catch(Exception e){
MyLog.error("aGa Say : Error in Mempl_unused.saveOrUpDate >>> employeeid ="+employeeid+"; dateid ="+dateid);
}
}//end if(data!=null)
}// end for
}catch(Exception e){
MyLog.error("aGa Say : Error in Mempl_unused.saveOrUpDate Cant get DBrecord");
}
}
private String trimPipe(String str){
return str.substring(1, str.length()-1);
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp0;
public class Mempl_vacation extends RecordCmp0 {
public Mempl_vacation() {
super("Mempl_vacation", "Mempl_vacation Table");
}
}
package com.csc.library.databean;
import java.util.Vector;
import com.csc.library.database.FieldManager;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
public class Memployee_absent extends Memployee {
private DbInquiry inqTime = null;
private int absent = 0;
private String sDate = "";
private String eDate = "";
private int max_absent = 7; //來嘎馱識擏煬鋡珒忌僱埭菔矷揤銧橧牷煬駔奡
private Vector vAbsent = null;
public boolean foundData() {
this.absent = 0;
this.sDate = "";
this.eDate = "";
this.vAbsent = new Vector();
try {
if (this.param.containsKey("DAYABSENT")) { //園狳牷佴橏侍轅÷癡蚢勻桄孚涷D揮珗轄﹋奡蒶歖酷涷繒例 7 鉬蝜來嘎僩涷抌抉a畛
String d = (String) this.param.get("DAYABSENT");
if (d!=null && !d.equals("")) {
this.max_absent = Integer.parseInt(d);
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
boolean flag = super.foundData();
this.absent = this.countAbsent();
//System.out.println("Absent --------------------> "+this.absent);
if (this.absent < this.max_absent) {
return false;
}
return flag;
}
/*
* 照÷羅挹來嘎飾珒忌僱埭菔矷揤
* 漺邃芷a芩棸例 ttime_current
*/
private int countAbsent() {
int result = 0;
CscCalendar c1 = null;
CscCalendar c2 = null;
if (this.param.containsKey("__start_date") && this.param.containsKey("__end_date")) { //鄋蝖僩涷煬駔閫轄例﹌寥狳
c1 = new CscCalendar((String) this.param.get("__start_date"));
c2 = new CscCalendar((String) this.param.get("__end_date"));
} else {
c1 = new CscCalendar((String) this.param.get("STARTDATE"));
c2 = new CscCalendar((String) this.param.get("ENDDATE"));
}
//CscCalendar c1 = new CscCalendar("2007-07-01");
//CscCalendar c2 = new CscCalendar("2007-07-30");
String filter = "employeeid='"+this.getString("employeeid")+"' " +
"and (dateid between '"+c1.getYYYYMMDD()+"' and '"+c2.getYYYYMMDD()+"') ";
//"and (absent>0 or (eventgrp='H' or eventgrp='I'))";
try {
int count = 1;
CscCalendar cs = new CscCalendar();
if (this.inqTime == null) {
this.inqTime = new InitialInquiry(this.userPro).getDbInquiry();
this.inqTime.setParam(this.param);
this.inqTime.setSchemaName(this.userPro.getSchemaName());
this.inqTime.initMyTable("Ttime_current", "", "employeeid, dateid");
this.inqTime.setColumn("*");
}
this.inqTime.setFilter(filter);
this.inqTime.refresh();
while (this.inqTime.next()) {
DbRecord rec = this.inqTime.getCurrentDbRecord();
if (count==1) {
cs = new CscCalendar(rec.getString("dateid"));
this.sDate = cs.getDDMMYYYY();
this.eDate = cs.getDDMMYYYY();
}
CscCalendar csDate = new CscCalendar(rec.getString("dateid"));
if (rec.getDouble("hour_d")==0 && rec.getDouble("lt")==0 && rec.getDouble("absent")==0) {
cs = new CscCalendar(rec.getString("dateid"));
} else {
if (csDate.subForDay(cs) <= 1) {
if (rec.getDouble("absent") == rec.getDouble("hour_s")) {
result++;
this.vAbsent.add(rec.getString("dateid"));
if (result==1) {
this.sDate = csDate.getDDMMYYYY();
}
this.eDate = csDate.getDDMMYYYY();
} else {
if (result>=this.max_absent)
break;
result = 0;
this.vAbsent.clear();
this.sDate = csDate.getDDMMYYYY();
this.eDate = csDate.getDDMMYYYY();
}
cs = new CscCalendar(rec.getString("dateid"));
} else {
if (result>=this.max_absent)
break;
result = 0;
this.vAbsent.clear();
this.sDate = csDate.getDDMMYYYY();
this.eDate = csDate.getDDMMYYYY();
}
}
count++;
}
MyLog.debug("max --->"+this.max_absent+" absent --->"+this.vAbsent.size()+" : vAbsent="+this.vAbsent);
MyLog.debug("sDate="+this.sDate+" : eDate="+this.eDate);
} catch (Exception e) {
MyLog.error(this, e);
}
return result;
}
public FieldManager getField(String fieldName) {
String Lang =(this.param.containsKey("__language"))?(String)this.param.get("__language"):this.getUProfile().get("lang");
FieldManager fm = super.getField(fieldName);
if (fieldName.equalsIgnoreCase("absentcount")) { //來嘎嘎揤煬鋡珒忌僱埭菔矷揤
fm = this.initField("String", "absentcount", 10, 0, "Absent Count");
fm.setWorking(true);
fm.setUProfile(this.userPro);
try {
fm.set(this.absent);
if (Lang.equalsIgnoreCase("eng")) {
fm.setDescription("Absent Count");
} else {
fm.setDescription("來嘎嘎揤煬鋡珒忌");
}
} catch (Exception ex) {
MyLog.error(this, ex);
}
}
return fm;
}
public String getString(String fieldName) {
if (fieldName.equalsIgnoreCase("sDate")) {
return this.sDate;
} else if (fieldName.equalsIgnoreCase("eDate")) {
return this.eDate;
} else if (fieldName.indexOf("absent_")>-1) {
int id = Integer.parseInt(fieldName.substring(7, fieldName.length()));
if (id <= this.vAbsent.size()) {
CscCalendar c = new CscCalendar((String) this.vAbsent.get(id-1));
return c.getDDMMYYYY();
} else return "";
}
return super.getString(fieldName);
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Iterator;
import com.csc.library.database.FieldManager;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.timeattendance.DayShift;
import com.csc.library.timeattendance.Shift;
import com.csc.library.timeattendance.WorkingShift;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyTreeMap;
/*
* class 㹡èѴ šèѺШ͹
* NOT USE 2008/09/17
*/
public class Memployee_reserve extends Memployee {
MyTreeMap hmField;
String column="";
public int search() {
int find = super.search();
this.hmField = new MyTreeMap();
if (find == 1) {
this.setSwipeRecord();
}
//this.param.put("hmField", this.hmField);
//this.userPro.put("hmField", this.hmField);
MyLog.debug(this, " ==== RESULT ==== ");
MyLog.debug(this, this.hmField.toString());
return find;
}
/*
* ӡҧ field ͹
*/
private FieldManager initalField(String fmName) {
FieldManager fm = this.initField("String", fmName, 20, 0, "String");
fm.setWorking(true);
fm.setDefault("");
fm.setName(fmName);
fm.setComType("text");
fm.setWidth(10);
fm.set("");
return fm;
}
public void setSwipeRecord() {
int month = Integer.parseInt((String)this.param.get("__month"));
int year = Integer.parseInt((String)this.param.get("__year"));
CscCalendar cs1 = new CscCalendar("01-"+month+"-"+year);
CscCalendar cs2 = new CscCalendar(cs1.getEndDateOfMonth()+"-"+month+"-"+year);
//CscCalendar cs1 = new CscCalendar("20-11-2006");
//CscCalendar cs2 = new CscCalendar("25-11-2006");
MyLog.debug(this, "employeeid======="+this.getString("employeeid"));
MyLog.debug(this, "startdate======="+this.getString("startdate"));
MyLog.debug(this, "resigndate======="+this.getString("resigndate"));
try {
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0", "", "");
inq.setColumn("*");
this.putChild(inq);
this.refreshChild("Mtime0");
if (this.getChild("mtime0")!=null) {
Mtime0 timeRec = (Mtime0) (((DbInquiry) this.getChild("mtime0")).getCurrentDbRecord());
timeRec.setEmpRec((DbRecord) this);
WorkingShift ws = timeRec.genWorkingShift(new CscCalendar(cs1 .getTimestamp()), new CscCalendar(cs2.getTimestamp()));
MyLog.debug(this, "Working Shift of :> "+this.getString("employeeid"));
ws.setUProfile(this.userPro);
ws.setEmployeeid(this.getString("employeeid"));
ws.adjust();
ws.createLink();
ws.genTimeZone();
MyLog.debug(this, "<<< ADJUST >>>");
MyLog.debug(this, ws.getUprofile(), ws.toString());
DecimalFormat df = new DecimalFormat("00.00");
Iterator it_ws = ws.keySet().iterator();
while (it_ws.hasNext()) {
DayShift ds = (DayShift) ws.get(it_ws.next());
Iterator it_ds = ds.keySet().iterator();
while (it_ds.hasNext()) {
Shift sh = (Shift) ds.get(it_ds.next());
MyLog.debug(this, this.getUProfile(), sh.toString());
//2006-08-0108.0001T00
//2006-08-0117.0001T01
String inCode = sh.getShiftDate().getYYYYMMDD()+"-"+sh.get_c_dt_in().getYYYYMMDD()+
df.format(Double.parseDouble(String.valueOf(sh.get_c_dt_in().getCSCTime())))+
sh.getTimeCode()+
sh.getTR_Type().substring(0,1)+
"00";
String inCodeInq = sh.getShiftDate().getYYYYMMDD()+
df.format(Double.parseDouble(String.valueOf(sh.get_c_dt_in().getCSCTime())))+
sh.getTimeCode()+
sh.getTR_Type().substring(0,1)+
"00";
String outCode = sh.getShiftDate().getYYYYMMDD()+"-"+sh.get_c_dt_out().getYYYYMMDD()+
df.format(Double.parseDouble(String.valueOf(sh.get_c_dt_out().getCSCTime())))+
sh.getTimeCode()+
sh.getTR_Type().substring(0,1)+
"01";
String outCodeInq = sh.getShiftDate().getYYYYMMDD()+
df.format(Double.parseDouble(String.valueOf(sh.get_c_dt_out().getCSCTime())))+
sh.getTimeCode()+
sh.getTR_Type().substring(0,1)+
"01";
DbInquiry inqSwipe = new InitialInquiry(this.userPro).getDbInquiry();
inqSwipe.setSchemaName(this.userPro.getSchemaName());
inqSwipe.initMyTable("Ttimetemp", "", "");
inqSwipe.setColumn("*");
String filter = "employeeid='"+this.getString("employeeid")+"' and (reservecode='"+inCodeInq+"')";
DbInquiry inqReserve = new InitialInquiry(this.userPro).getDbInquiry();
inqReserve.setSchemaName(this.userPro.getSchemaName());
inqReserve.initMyTable("Ttimereserve", filter, "");
inqReserve.setColumn("*");
inqReserve.putChild(inqSwipe);
inqReserve.refresh();
if (inqReserve.next()) {
DbRecord rec = inqReserve.getCurrentDbRecord();
MyLog.debug(this, rec.getString("reservecode")+" : "+rec.getString("ttimetemp"));
FieldManager fm = this.initalField(rec.getString("reservecode"));
fm.set(rec.getString("ttimetemp"));
fm.setProperty("initvalue", rec.getString("ttimetemp"));
this.hmField.put(inCode, fm);
FieldManager fm2 = this.initalField(rec.getString("ttimetemp"));
fm2.set(rec.getChild("Ttimetemp").getString("swipedate")+"|"+rec.getChild("Ttimetemp").getString("swipetime"));
fm2.setProperty("initvalue", rec.getChild("Ttimetemp").getString("swipedate")+"|"+rec.getChild("Ttimetemp").getString("swipetime"));
this.hmField.put(rec.getString("ttimetemp"), fm2);
} else {
FieldManager fm = this.initalField(inCode);
this.hmField.put(inCode, fm);
}
filter = "employeeid='"+this.getString("employeeid")+"' and (reservecode='"+outCodeInq+"')";
inqReserve.setFilter(filter);
inqReserve.refresh();
if (inqReserve.next()) {
DbRecord rec = inqReserve.getCurrentDbRecord();
MyLog.debug(this, rec.getString("reservecode")+" : "+rec.getString("ttimetemp"));
FieldManager fm = this.initalField(rec.getString("reservecode"));
fm.set(rec.getString("ttimetemp"));
fm.setProperty("initvalue", rec.getString("ttimetemp"));
this.hmField.put(outCode, fm);
FieldManager fm2 = this.initalField(rec.getString("ttimetemp"));
fm2.set(rec.getChild("Ttimetemp").getString("swipedate")+"|"+rec.getChild("Ttimetemp").getString("swipetime"));
fm2.setProperty("initvalue", rec.getChild("Ttimetemp").getString("swipedate")+"|"+rec.getChild("Ttimetemp").getString("swipetime"));
this.hmField.put(rec.getString("ttimetemp"), fm2);
} else {
FieldManager fm = this.initalField(outCode);
this.hmField.put(outCode, fm);
}
}
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
MyLog.debug(this, "######## HM : "+this.hmField.keySet());
MyLog.debug(this, "######## HM : "+this.hmField);
}
protected boolean preUpdateTrigger() {
boolean b = super.preUpdateTrigger();
try {
//this.hmField = (MyTreeMap) this.userPro.get((Object) "hmField");
MyLog.debug("+++++++++ MEMPLOYYEE_RESERVE PREUPDATE PARAM +++++++++++");
MyLog.debug(this.param.toString());
this.column = this.getFieldList();
//this.setColumn("employeeid,companyid");
DbRecord rec = new InitialRecord(this.userPro).getDbRecord("Ttimereserve");
Iterator it = this.hmField.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
try {
if (key.length()>15) {
FieldManager fm = (FieldManager) this.hmField.get(key);
if (!fm.getProperty("initvalue").equals(this.getParam("__"+key.toLowerCase()))) {
rec.set("employeeid", this.getString("employeeid"));
rec.set("companyid", this.getString("companyid"));
rec.set("reservecode", key.substring(11, key.length()));
MyLog.debug(this, key);
if (this.getParam("__"+key.substring(11, key.length()).toLowerCase())!=null && !this.getParam("__"+key.substring(11, key.length()).toLowerCase()).trim().equals("")) {
rec.set("ttimetemp", this.getParam("__"+key.substring(11, key.length()).toLowerCase()));
rec.save();
} else if (this.getParam("__"+key.toLowerCase())!=null && !this.getParam("__"+key.toLowerCase()).trim().equals("")) {
rec.set("ttimetemp", this.getParam("__"+key.toLowerCase()).trim());
rec.save();
}else {
rec.set("ttimetemp", fm.getProperty("initvalue"));
rec.delete();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception ex) {
MyLog.error(this, ex);
}
return b;
}
public FieldManager getField(String fieldName) {
FieldManager fm;
if (this.hmField!=null && this.hmField.containsKey(fieldName)) {
fm = (FieldManager) this.hmField.get(fieldName);
} else fm = super.getField(fieldName);
return fm;
}
public MyTreeMap getHashData() {
return this.hmField;
}
protected void postUpdateTrigger() throws Exception {
super.postUpdateTrigger();
//this.setColumn(this.column);
}
}
package com.csc.library.databean;
import java.text.DecimalFormat;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialRecord;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
public class Memployee_ta extends Memployee {
/*
* ŧѹҾѡ͹ٻ 0, 0.5
* к DD:HH:SS
*/
public String getString(String fieldName) {
try {
if(fieldName.indexOf(".") > -1){ /* óշٵͷ¡Ҩҡ table 蹷١Ѻ employee ҧ emp.getString("MJOBCODE.JOBGRADEID") */
String table = fieldName.substring(0,fieldName.indexOf("."));
String field = fieldName.substring(fieldName.indexOf(".")+1);
DbRecord db = new InitialRecord(this.userPro).getDbRecord(table);
db.setColumn("*");
this.putChild(db);
this.refreshChild();
if(this.foundData()){ /* */
return this.getChild(table).getString(field);
}
} else { /* ¡Ŵ컡㹵ҧ memployee */
return super.getString(fieldName);
}
}catch(Exception e){
MyLog.error(this,e);
}
return "";
}
/* Ѻʡ ͧѡҹѹ 觵ͧҨҡ MTime2 öʡз Table Memployee */
public String getDailyTime0id(CscCalendar date){
String time0id = "";
try {
DbRecord timeRec = new InitialRecord(this.userPro).getDbRecord("MTIME0");
timeRec.set("time0id",this.getString("time0"));
timeRec.set("companyid",this.getString("companyid"));
timeRec.setColumn("*");
if (timeRec.search() == 1){
if(timeRec.getString("status").equals("1")){ /* 繵ҧ ͧҵ MTime2 ѹèʡ */
DbRecord time2 = new InitialRecord(this.userPro).getDbRecord("MTIME2");
time2.set("time0id", this.getString("time0"));
time2.set("monthid", date.getCurrentMonth());
time2.set("yearid", date.getYear());
time2.set("companyid", this.getString("companyid"));
time2.setColumn("*");
if(time2.search() == 1){
/* ֧ʡ ѹͧ͹ 㹪ͧʡЪͧá (˹ѹ 3 軡Ԩͧá )*/
DecimalFormat df = new DecimalFormat("00");
time0id = time2.getString("time" + df.format(date.getDate()) + '1');
} else {
MyLog.error("!! Error : can't get time0id from MTIME2 !!");
}
} else { /* 繵ҧ÷ӧҹ ʹ*/
time0id = timeRec.getString("time0id");
}
}
}catch(Exception e){
MyLog.error("!! Error : Can't get time0id from employeeid --> " + this.getString("employeeid"));
}
return time0id;
}
/**
* ֧ҵ fix table mempl_fix
* @param field ͿŴͧ
* @return double ѾͧŴ
*/
public double getFixDouble(String field) {
double value = 0.0d;
try {
DbRecord mempl = new InitialRecord(this.userPro).getDbRecord("mempl_fix");
mempl.set("employeeid",this.getString("employeeid"));
mempl.setParam("rsc_skip","true");
mempl.set("fixtabid",field);
mempl.setColumn("*");
if (mempl.search() == 1){
value = mempl.getDouble("emp_data");
}
}catch(Exception e){
MyLog.error(this,e);
}
return value;
}
}
package com.csc.library.databean;
import java.text.DecimalFormat;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
/*
* Ѻ͡§ҹ ػ÷ӧҹШ͹ͧ KKB
* ¢Ź鹨еͧӡûż ʹ͹ҡ͹
* 觨 Tworking_summary
*/
public class Memployee_working_avg_of_year extends Memployee {
private MyHashMap hm = null;
private MyHashMap hmTotal = null;
private DbInquiry inqWorking = null;
private DecimalFormat df = new DecimalFormat("0.00");
private boolean result = false;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
//this.param.put("year", "2007");
this.initialColumn();
this.result = this.setData();
}
return temp;
}
public boolean foundData() { //Ҿ ¡鹡ŧ Tworking_summary ׷ӡâ
if (this.result==false) {
return false;
} else return super.foundData();
}
private void initialColumn() {
if (this.hm==null) {
this.hm = new MyHashMap();
}
for (int i=1;i<=12;i++) {
this.hm.put(String.valueOf(i), "0.00");
}
this.hm.put("total", "0.00");
}
private void initialColumnTotal() {
if (this.hmTotal==null) {
this.hmTotal = new MyHashMap();
}
for (int i=1;i<=12;i++) {
this.hmTotal.put("office_"+i, "0.00");
this.hmTotal.put("emp_"+i, "0");
this.hmTotal.put("office_total_"+i, "0.00");
}
this.hmTotal.put("office_total", "0.00");
}
private int getMonthWorking() {
int i = 12;
int year = Integer.parseInt((String) this.param.get("YEAR"));
CscCalendar startDate = new CscCalendar(this.getString("startdate"));
CscCalendar resignDate = new CscCalendar(this.getString("resigndate"));
resignDate.decDate();
if (startDate.getYear()<year && resignDate.getYear()>year) { //ѧ㹻շҧҹ͡
i = 12;
} else if (startDate.getYear()==year && resignDate.getYear()>year) { //ҧҹ㹻չ
i = Integer.parseInt(startDate.getMM());
} else if (startDate.getYear()>year && resignDate.getYear()==year) { //͡㹻չ
i = Integer.parseInt(resignDate.getMM());
} else if (startDate.getYear()==year && resignDate.getYear()==year) { //ҧҹ͡չ
i = Integer.parseInt(resignDate.getMM()) - Integer.parseInt(startDate.getMM());
}
return i;
}
private boolean setData() {
boolean data = false;
try {
String year = (String) this.param.get("YEAR");
double total = 0;
int month = 0;
if (this.inqWorking == null) {
this.inqWorking = new InitialInquiry(this.getUProfile()).getDbInquiry();
this.inqWorking.setSchemaName(this.getUProfile().getSchemaName());
this.inqWorking.initMyTable("Tworking_summary","", "employeeid,yearid,monthid");
this.inqWorking.setColumn("*");
}
this.inqWorking.setFilter("employeeid='"+this.getString("employeeid")+"' and " +
"yearid="+year+"");
this.inqWorking.refresh();
while (this.inqWorking.next()) {
DbRecord rec = this.inqWorking.getCurrentDbRecord();
if (!rec.getString("swipetype").equalsIgnoreCase("N")) { // N=¡鹡ŧҤԴ
this.hm.put(rec.getString("monthid"), this.df.format(rec.getDouble("working_avg")));
total += rec.getDouble("working_avg");
if ((rec.getDouble("working_avg"))>0) { //͹ա÷ӧҹѺ ͹价ӡ
month++;
}
data = true;
} else data = false;
}
//this.hm.put("total", this.df.format(total/12));
if (data) {
//this.hm.put("total", this.df.format(total/this.getMonthWorking()));
if (month==0) {
this.hm.put("total", "0.00");
} else this.hm.put("total", this.df.format(total/month));
}
} catch (Exception e) {
MyLog.error(this, e);
}
return data;
}
private void summaryTotal() {
String year = (String) this.param.get("YEAR");
try {
String filter = "yearid="+year+" and swipetype<>'N'";
if (this.param.containsKey("BRANCH") && !((String)this.param.get("BRANCH")).equals("")) {
filter += " and branch="+(String)this.param.get("BRANCH");
}
DbInquiry inqTotal = new InitialInquiry(this.getUProfile()).getDbInquiry();
inqTotal.setSchemaName(this.getUProfile().getSchemaName());
inqTotal.initMyTable("Tworking_summary",filter, "");
inqTotal.setColumn("*");
inqTotal.refresh();
while (inqTotal.next()) {
DbRecord rec = inqTotal.getCurrentDbRecord();
String m = rec.getString("monthid");
String old_work = this.hmTotal.getString("office_"+m);
if (rec.getDouble("working_avg")>0) {
double work = rec.getDouble("working_avg") + Double.parseDouble(old_work);
String old_emp = this.hmTotal.getString("emp_"+m);
int emp = Integer.parseInt(old_emp);
emp++;
this.hmTotal.put("office_"+m, work);
this.hmTotal.put("emp_"+m, emp);
}
}
double data = 0;
for (int i=1;i<=12;i++) {
String working_avg = this.hmTotal.getString("office_"+i);
String emp = this.hmTotal.getString("emp_"+i);
double result = 0;
if (!emp.equals("0")) {
result = Double.parseDouble(working_avg)/Integer.parseInt(emp);
}
this.hmTotal.put("office_total_"+i, this.df.format(result));
data += result;
}
//this.hmTotal.put("office_total", this.df.format(data/12));
if(this.getMonthWorking()>0)
this.hmTotal.put("office_total", this.df.format(data/this.getMonthWorking()));
else
this.hmTotal.put("office_total", this.df.format(0.00));
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > -1) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > -1) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hm.get(fName) != null) {
return String.valueOf(this.hm.get(fName));
}
if (fName.indexOf("office")>-1) {
if (this.hmTotal == null) {
this.initialColumnTotal();
this.summaryTotal();
}
if (this.hmTotal.get(fName) != null) {
return String.valueOf(this.hmTotal.get(fName));
}
}
}
return super.getString(fieldName);
}
}
package com.csc.library.databean;
import java.util.Vector;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
import com.csc.library.utilities.MyLog;
public class Memployee_working_manhour extends Memployee {
private boolean flag = false;
private Vector vCode;
private DbInquiry inqCurrent = null;
private DbInquiry inqHistory = null;
private DbInquiry inqLeave = null;
private CscCalendar cscStart = null;
private CscCalendar cscEnd = null;
private CscTime working;
private CscTime leave;
public int assignField(DataSet rs) {
this.cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
this.cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
/*
this.cscStart = new CscCalendar("01-01-2007");
this.cscEnd = new CscCalendar("31-12-2007");
*/
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
if (this.flag==false) {
this.vCode = this.getEventgrpVacation();
this.flag=true;
}
this.working = new CscTime(0);
this.leave = new CscTime(0);
this.getData();
}
return temp;
}
//һѹ繻Ҿѡ͹ ͨ仺ǡ㹡
private Vector getEventgrpVacation() {
Vector v = new Vector();
try {
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Meventgrp", "daytype='7'","");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
v.add(inq.getString("eventgrpid"));
}
} catch (Exception e) {
MyLog.error(this, e);
}
return v;
}
private void getData() {
// . ӧҹͧӧҹ
try {
if (this.inqCurrent==null) {
this.inqCurrent = new InitialInquiry(this.userPro).getDbInquiry();
this.inqCurrent.initMyTable("Ttime_current", "", "dateid");
this.inqCurrent.setColumn("*");
}
this.inqCurrent.setFilter("employeeid='"+this.getString("employeeid")+"' " +
"and hour_d>0 and ot<>hour_d " +
"and (dateid between '"+this.cscStart.getYYYYMMDD()+"' and '"+this.cscEnd.getYYYYMMDD()+"')");
this.inqCurrent.refresh();
while (this.inqCurrent.next()) {
this.working.add(this.inqCurrent.getCurrentDbRecord().getFloat("hour_s"));
}
} catch (Exception e) {
MyLog.error(this, e);
}
try {
if (this.inqHistory==null) {
this.inqHistory = new InitialInquiry(this.userPro).getDbInquiry();
this.inqHistory.initMyTable("Ttime_history", "", "dateid");
this.inqHistory.setColumn("*");
}
this.inqHistory.setFilter("employeeid='"+this.getString("employeeid")+"' " +
"and hour_d>0 and ot<>hour_d "+
"and (dateid between '"+this.cscStart.getYYYYMMDD()+"' and '"+this.cscEnd.getYYYYMMDD()+"')");
this.inqHistory.refresh();
while (inqHistory.next()) {
this.working.add(inqHistory.getCurrentDbRecord().getFloat("hour_s"));
}
} catch (Exception e) {
MyLog.error(this, e);
}
// .ӡҷ ¡Ҿѡ͹
try {
String lv_type = "";
float m_lv = 0;
if (this.inqLeave==null) {
this.inqLeave = new InitialInquiry(this.userPro).getDbInquiry();
this.inqLeave.initMyTable("Tleave_summary", "", "dateid");
this.inqLeave.setColumn("*");
}
this.inqLeave.setFilter("employeeid='"+this.getString("employeeid")+"' " +
"and (doctype='A' or doctype='S') " +
"and (dateid between '"+this.cscStart.getYYYYMMDD()+"' and '"+this.cscEnd.getYYYYMMDD()+"')");
this.inqLeave.refresh();
while (this.inqLeave.next()) {
lv_type = this.inqLeave.getCurrentDbRecord().getString("lv_type");
m_lv = this.inqLeave.getCurrentDbRecord().getFloat("m_lv");
if (this.vCode!=null && !this.vCode.contains(lv_type)) {
this.leave.add(m_lv);
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
System.out.println("===> working : "+this.working.getFloat());
System.out.println("===> leave : "+this.leave.getFloat());
}
public String getString(String fieldName) {
if (fieldName.equalsIgnoreCase("working_result")) {
return String.valueOf(this.working.getFloat());
} else if (fieldName.equalsIgnoreCase("leave_result")) {
return String.valueOf(this.leave.getFloat());
} else {
return super.getString(fieldName);
}
}
/**
* for test
*/
private String getManHour(){
String manHour ="1.11";
return manHour;
}//end method getManHour
}
package com.csc.library.databean;
import com.csc.library.databean.Memployee;
import com.csc.library.session.DbInquiry;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
public class Memployee_working_result extends Memployee {
public void preInqNext() {
try {
CscCalendar cscStart = new CscCalendar((String) this.param.get("STARTDATE"));
CscCalendar cscEnd = new CscCalendar((String) this.param.get("ENDDATE"));
String filter = "(dateid between '"+cscStart.getYYYYMMDD()+"' and '"+cscEnd.getYYYYMMDD()+"')";
DbInquiry inqCurrent = (DbInquiry) this.getChild("vw_worktime");
inqCurrent.setFilter(filter);
this.refreshChild("vw_worktime");
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
package com.csc.library.databean;
import java.text.DecimalFormat;
import com.csc.library.database.MyHashMap;
public class Memployee_working_summarize_liteon extends Memployee_working_summarize {
private DecimalFormat dfH = new DecimalFormat("0");
public String getString(String fieldName) {
if (fieldName.indexOf("$") > -1) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
String result = "";
if (fieldName.indexOf("$") >= 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hmHeader.containsKey(fName)) {
return this.getResult(this.hmHeader.getString(fName));
} else if (fName.indexOf("col")>-1 && this.hmHeader.containsKey(fName.substring(0, fName.indexOf("_")))) {
MyHashMap hm = (MyHashMap) this.hmHeader.get(fName.substring(0, fName.indexOf("_")));
return this.getResult(hm.getString(fName));
} else super.getString(fieldName);
}
return super.getString(fieldName);
}
private String getResult(String value) {
if (value.indexOf(":")>-1) {
double result = 0;
String[] x = value.split(":");
double tmp0 = Double.parseDouble(x[0]);
double tmp1 = Double.parseDouble(x[1]);
if (this.hourwork>0 && tmp1>0 && tmp1/this.hourwork<=0.5) {
result = tmp0+0.5;
} else if (this.hourwork>0 && tmp1>0 && tmp1/this.hourwork>0.5) {
result = tmp0+1;
} else result = tmp0;
return dfH.format(result*this.hourwork);
} else {
if (value==null || value.equals("null") || value.equals("")) {
return "0";
} else return value;
}
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.Iterator;
import com.csc.library.database.DataSet;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.timeattendance.DayShift;
import com.csc.library.timeattendance.Shift;
import com.csc.library.timeattendance.WorkingShift;
import com.csc.library.utilities.CscCalendar;
public class Memployee_worktime extends Memployee {
WorkingShift wShift = new WorkingShift();
public Memployee_worktime() {
super();
}
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (temp != 0) {
if (this.param.containsKey("__beginDate")) {
if (this.param.containsKey("__endDate")) {
if (this.param.get("__endDate").toString().trim().equals("")) {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString());
} else {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString(),
this.param.get("__endDate").toString());
}
} else {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString());
}
// this.displayWorkingShift(this.wShift);
}
}
return temp;
}
private void displayWorkingShift(WorkingShift ws) {
if (!ws.isEmpty()) {
MyLog.debug( this,"\n<<<<<<<<<<<<<<<<<<<<<<<<<< Display WorkingShift >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
for (Iterator IT = ws.keySet().iterator(); IT.hasNext();) {
String key = (String) IT.next();
DayShift dShift = (DayShift) ws.get(key);
for (Iterator IT1 = dShift.keySet().iterator(); IT1.hasNext();) {
String key1 = (String) IT1.next();
Shift sh = (Shift) dShift.get(key1);
MyLog.debug(this, "**** Date=" + key + " **** Time=" + key1
+ " **** Shift " + " >>> Begin="
+ sh.get_c_dt_in().getCSCTime() + " >>> End="
+ sh.get_c_dt_out().getCSCTime()
+ " >>> Time Code=" + sh.getTimeCode()
+ " >>> Type=" + sh.getTR_Type().substring(0, 1)
+ " >>> Leave=" + sh.getLv() + " >>> Leave Type="
+ sh.getLV_Type());
}
MyLog.debug(this,"--------------------------------------------------------------------------------------------------------------------------------");
}
} else
MyLog.debug(this,"++++++++++++++++++++++++ WorkingShift is Empty +++++++++++++++++++++++++");
}
private WorkingShift genWorkTime(String beginDate) {
WorkingShift ws = null;
try {
boolean adjust = false; // param value -----> 1=adjust is true, 0=adjust is false
if (this.param.containsKey("__adjust")) {
if (((String) this.param.get("__adjust")).equalsIgnoreCase("1")) {
adjust = true;
}
}
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setParam(this.param);
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0", "time0id='" + this.getString("time0") + "'", "");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
Mtime0 rec = (Mtime0) inq.getCurrentDbRecord();
ws = rec.genWorkingShift(new CscCalendar(beginDate));
if (!ws.isEmpty()) {
ws.setUProfile(this.userPro);
ws.adjust();
ws.overlapChecking();
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
MyLog.debug(this, ">>>>>>>>>>> WORKING SHIFT=" + ws);
return ws;
}
private WorkingShift genWorkTime(String beginDate, String endDate) {
WorkingShift ws = null;
try {
boolean adjust = false; // param value -----> 1=adjust is true, 0=adjust is false
if (this.param.containsKey("__adjust")) {
if (((String) this.param.get("__adjust")).equalsIgnoreCase("1")) {
adjust = true;
}
}
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setParam(this.param);
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0", "time0id='" + this.getString("time0") + "'", "");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
Mtime0 rec = (Mtime0) inq.getCurrentDbRecord();
CscCalendar cs1 = new CscCalendar(beginDate);
CscCalendar cs2 = new CscCalendar(endDate);
ws = rec.genWorkingShift(cs1, cs2);
if (!ws.isEmpty() && adjust == true) {
ws.setUProfile(this.userPro);
ws.adjust();
ws.overlapChecking();
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
return ws;
}
public WorkingShift getWorkingShift() {
return this.wShift;
}
public int search() {
try {
super.search();
if (this.param.containsKey("__beginDate")) {
if (this.param.containsKey("__endDate")) {
if (this.param.get("__endDate").toString().trim().equals("")) {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString());
} else {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString(),
this.param.get("__endDate").toString());
}
} else {
this.wShift = this.genWorkTime(this.param.get("__beginDate").toString());
}
// this.displayWorkingShift(this.wShift);
}
return 1;
} catch (Exception e) {
MyLog.error(this, e);
return 0;
}
}
}
\ No newline at end of file
/*
* Created on 16 .. 2548
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.Iterator;
import com.csc.library.database.DataSet;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.timeattendance.DayShift;
import com.csc.library.timeattendance.ManageAdjustChangeHoliday;
import com.csc.library.timeattendance.ManageAdjustLeave;
import com.csc.library.timeattendance.ManageAdjustOT;
import com.csc.library.timeattendance.Shift;
import com.csc.library.timeattendance.WorkingShift;
import com.csc.library.utilities.CscCalendar;
/**
* @author XeroX
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
* ʴἹ÷ӧҹͧѡҹ ͡ѧ˹Ҩ ʴἹ÷ӧҹ
*/
public class Memployee_worktime1 extends Memployee {
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (temp != 0) {
this.setWorkTime();
}
return temp;
}
public boolean set(String field, String value) {
if (field.trim().equalsIgnoreCase("dayshift")) {
this.setWorkTime();
}
return super.set(field, value);
}
public void setWorkTime() {
try {
CscCalendar cs = new CscCalendar();
String startDate = "1-" + cs.getMM() + "-" + cs.getYear();
String endDate = cs.getDDMMYYYY();
if (this.param.containsKey("date_start")) {
String st = (String) this.param.get("date_start");
if (!st.trim().equals("")) {
CscCalendar csS = new CscCalendar(st);
startDate = csS.getDDMMYYYY();
}
}
if (this.param.containsKey("date_end")) {
String en = (String) this.param.get("date_end");
if (!en.trim().equals("")) {
CscCalendar csE = new CscCalendar(en);
endDate = csE.getDDMMYYYY();
}
}
if (this.param.containsKey("start_date_ot")) {
String st = (String) this.param.get("start_date_ot");
if (!st.trim().equals("")) {
CscCalendar csS = new CscCalendar(st);
csS.decDate(5);
startDate = csS.getDDMMYYYY();
}
}
if (this.param.containsKey("end_date_ot")) {
String en = (String) this.param.get("end_date_ot");
if (!en.trim().equals("")) {
CscCalendar csE = new CscCalendar(en);
csE.incDate(5);
endDate = csE.getDDMMYYYY();
}
}
Mtime0 rec = (Mtime0) new InitialRecord(this.userPro).getDbRecord("Mtime0");
rec.setParam(this.param);
rec.setColumn("*");
this.putChild(rec);
this.search();
if (!this.getChild("Mtime0").getString("time0id").equals("")) {
CscCalendar cs1 = new CscCalendar(startDate);
CscCalendar cs2 = new CscCalendar(endDate);
rec.setEmpRec(this);
WorkingShift ws = rec.genWorkingShift(new CscCalendar(cs1.getYYYYMMDD()), new CscCalendar(cs2.getYYYYMMDD()),"true");
ws.setUProfile(this.userPro);
ws.meargeWithShiftTrans(this, new CscCalendar(cs1.getYYYYMMDD()), new CscCalendar(cs2.getYYYYMMDD()));
if (!ws.isEmpty()) {
ws.setUProfile(userPro);
ws.setEmprec(this);
ws.setEmployeeid(this.getString("employeeid"));
ws.setEmpTimeCode(this.getString("time0"));
ws.adjust(); /* ѺἹ੾¹ š */
ws.createLink();
/* ¹ѹشһѺἹ */
ManageAdjustChangeHoliday mac = new ManageAdjustChangeHoliday(userPro);
ws.adjustChangeHoliday(mac.getAdjustChangeHolidayData(ws, this),userPro);
/* ѺἹѺ */
ManageAdjustLeave mal = new ManageAdjustLeave(userPro);
ws.adjustDocument(mal.getAdjustLeaveData(ws, this, rec, "approve != 'W'"),userPro);
/* ѺἹѺâͷ */
ManageAdjustOT mao = new ManageAdjustOT(userPro);
ws.adjustDocument(mao.getAdjustOTData(ws, this, rec),userPro);
ws.overlapChecking();
ws.setTime0ContinueOT();
this.param.put("ws", ws);
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
}
/*
* Created on 5 .. 2548
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.Iterator;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.InitialRecord;
import com.csc.library.timeattendance.DayShift;
import com.csc.library.timeattendance.Shift;
import com.csc.library.timeattendance.WorkingShift;
import com.csc.library.utilities.CscCalendar;
/**
* @author XeroX
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Memployee_worktime2 extends Memployee{
MyHashMap hm_data=new MyHashMap();
String lang="ENG";
public Memployee_worktime2() {
super();
}
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equals("")) {
this.setLang();
this.setDataHash();
this.setWorkTime();
}
return temp;
}
public void setLang(){
if (this.param.containsKey("LANGUAGE")) {
String codeL=(String)this.param.get("LANGUAGE");
if (!codeL.trim().equals("")) {
lang = codeL;
}
}
}
public void setDataHash(){
int eom=0,year=0,mm=0;
CscCalendar csD;
if (this.param.containsKey("DATE")) {
String st = (String)this.param.get("DATE");
CscCalendar csS = new CscCalendar(st);
eom = csS.getEndDateOfMonth();
year = csS.getYear();
mm = csS.getMonth()+1;
}
for(int i=1;i<=eom;i++){
this.hm_data.put("data"+i,"");
csD=new CscCalendar(i+"-"+mm+"-"+year);
this.hm_data.put("month"+i,i);
if (lang.trim().equalsIgnoreCase("ENG")) {
this.hm_data.put("dow"+i,csD.getDOWeng());
} else {
this.hm_data.put("dow"+i,csD.getDOWthi());
}
}
}
public void setWorkTime(){
try{
CscCalendar cs = new CscCalendar();
String startDate="1-"+cs.getMM()+"-"+cs.getYear();
String endDate=cs.getDDMMYYYY();
String dateM="";
if (this.param.containsKey("DATE")) {
String st = (String)this.param.get("DATE");
CscCalendar csS = new CscCalendar(st);
startDate = csS.getYear()+"-"+csS.getMM()+"-01";
endDate = csS.getYear()+"-"+csS.getMM()+"-"+csS.getEndDateOfMonth();
if (lang.trim().equalsIgnoreCase("ENG")) {
dateM = csS.getEngLongMonth()+" "+csS.getYear();
} else {
dateM = csS.getThaiLongMonth()+" "+csS.getYear();
}
this.hm_data.put("DATEFULL",dateM);
}
//MyLog.debug(this, "date --->>>> "+startDate +" <--> "+endDate);
Mtime0 rec = (Mtime0) new InitialRecord(this.userPro).getDbRecord("Mtime0");
rec.setParam(this.param);
rec.setColumn("*");
this.putChild(rec);
this.refreshChild();
MyLog.debug(this, "Mtime0------->>>>"+this.getChild("Mtime0").getString("time0id"));
if (!this.getChild("Mtime0").getString("time0id").equals("")) {
//MyLog.debug(this, "<<<<<<<-----------SetWorkTime-------------->>>>>>>>");
rec.setEmpRec(this.cloneRecord(false));
WorkingShift ws = rec.genWorkingShift(new CscCalendar(startDate),new CscCalendar(endDate), "true");
//MyLog.debug(this, "ws ------------>>>>>>>>>>>>>> "+ws);
if (!ws.isEmpty()) {
//MyLog.debug(this, "<<<<<<<<<<<<<<<<<WorkingShift Set>>>>>>>>>>>>>>>>>>>>");
ws.setUProfile(this.userPro);
ws.setEmployeeid(this.getString("employeeid"));
ws.adjust();
for (Iterator IT = ws.keySet().iterator(); IT.hasNext(); ) {
String key = (String) IT.next();
DayShift dShift = (DayShift) ws.get(key);
for (Iterator IT1 = dShift.keySet().iterator(); IT1.hasNext(); ) {
String key1 = (String) IT1.next();
Shift sh = (Shift) dShift.get(key1);
this.hm_data.put("data"+sh.getShiftDate().getDate(),sh.getResultTimeCode());
//MyLog.debug(this, "Month--> "+ sh.getShiftDate().getMM());
//MyLog.debug(this, "date--> "+ sh.getShiftDate().getYYYYMMDD()); // ѹͧ
//MyLog.debug(this, "shiftid--> "+ sh.getResultTimeCode()); //ʡ
//MyLog.debug(this, "datein--> "+ sh.getResult_c_dt_in().getYYYYMMDD()); //ѹͧٴ
//MyLog.debug(this, "timein--> "+ sh.getResult_c_dt_in().getCSCTime()); //ҷͧٴ
//MyLog.debug(this, "dateout--> "+ sh.getResult_c_dt_out().getYYYYMMDD()); //ѹͧٴ͡
//MyLog.debug(this, "timeout--> "+ sh.getResult_c_dt_out().getCSCTime()); //ҷͧٴ͡
}
}
}
}
} catch(Exception e) {
MyLog.error(this, e);
}
}
public String getString(String field) {
if (this.hm_data.containsKey(field)){
return this.hm_data.get(field).toString();
} else {
return super.getString(field);
}
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.database.FieldManager;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Meventgrp extends RecordCmp implements DbRecord {
public Meventgrp (){
super ("Meventgrp","Meventgrp Table");
}
public FieldManager getField(String fieldName) {
FieldManager fm = super.getField(fieldName);
if (fieldName.equalsIgnoreCase("requestbefore")) {
String data="";
fm = this.initField("String", "", 100, 0, "");
fm.setWorking(true);
fm.setUProfile(this.userPro);
if (this.userPro.get("lang").equalsIgnoreCase("tha")) {
fm.setDescription("ͧǧ˹");
if (this.getInt("DATEBEFOREREQUEST")>0) {
data = "ͧǧ˹ "+this.getInt("DATEBEFOREREQUEST")+" ѹ";
}
} else {
fm.setDescription("Day Before Request");
if (this.getInt("DATEBEFOREREQUEST")>0) {
data = "Day Before Request "+this.getInt("DATEBEFOREREQUEST")+" Days";
}
}
fm.setName("requestbefore");
fm.set(data);
}
return fm;
}
protected boolean preUpdateTrigger() throws Exception {
return super.preUpdateTrigger();
}
@Override
protected boolean preInsertTrigger() throws Exception {
return super.preInsertTrigger();
}
}
package com.csc.library.databean;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Meventgrp1 extends RecordCmp implements DbRecord {
public Meventgrp1 (){
super ("Meventgrp1","Meventgrp1 Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Meventgrpbranch extends RecordCmp implements DbRecord {
public Meventgrpbranch(){
super ("Meventgrpbranch","Meventgrpbranch Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mexe_permission extends RecordCmp{
public Mexe_permission() {
super("Mexe_permission", "Mexe_permission Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mholiday0 extends RecordCmp implements DbRecord {
public Mholiday0 (){
super ("Mholiday0","Mholiday0 Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.database.FieldManager;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
import com.csc.library.utilities.CscCalendar;
public class Mholiday1 extends RecordCmp implements DbRecord {
public Mholiday1 (){
super ("Mholiday1","Mholiday1 Table");
}
public FieldManager getField(String fieldName) {
if (fieldName.equalsIgnoreCase("fullthaidate")) {
FieldManager fm = this.initField("String", "fullthaidate", 40, 0, "Full Thai Date");
fm.setWorking(true);
fm.setUProfile(this.userPro);
CscCalendar c = new CscCalendar(this.getString("hdate"));
fm.set("ѹ "+c.getLongThiDOW()+" "+c.getDD()+" "+c.getThaiLongMonth()+" "+c.getThaiYYYY());
return fm;
} else return super.getField(fieldName);
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mleave_report extends RecordCmp implements DbRecord{
public Mleave_report() {
super("Mleave_report","Mleave_report Tabel");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mottype extends RecordCmp implements DbRecord {
public Mottype() {
super("Mottype", "Mottype Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mreason_ot extends RecordCmp{
public Mreason_ot(){
super("Mreason_ot", "Mreason ot Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mreasonchange extends RecordCmp{
public Mreasonchange(){
super("Mreasonchange", "Mreasonchange Table");
}
}
/*
* Created on 8 .. 2549
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
/**
* @author vassana
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Msleep_pattern extends RecordCmp implements DbRecord {
public Msleep_pattern() {
super("Msleep_pattern", "Msleep_pattern Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mstation extends RecordCmp{
public Mstation() {
super("Mstation", "Mstation Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.DbRecord;
import com.csc.library.session.RecordCmp;
public class Mswipetime extends RecordCmp implements DbRecord {
public Mswipetime() {
super("Mswipetime", "Mswipetime Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.MyLog;
public class Mtime2_gmplan extends Mtime2 {
protected boolean preInsertTrigger() throws Exception {
boolean result = super.preInsertTrigger();
try {
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setParam(this.param);
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0", "time0id='"+this.getString("time0id")+"'", "");
inq.setColumn("time0id, companyid");
inq.refresh();
if (inq.next()) {
return true;
} else return false;
} catch (Exception e) {
MyLog.error(this, e);
}
return result;
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mvacation0 extends RecordCmp {
public Mvacation0() {
super("Mvacation0", "Mvacation0 Table");
}
}
package com.csc.library.databean;
import com.csc.library.session.RecordCmp;
public class Mvacation1 extends RecordCmp {
public Mvacation1() {
super("Mvacation1", "Mvacation1 Table");
}
}
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.HashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
/*
* ʴšüԴҴ Ἱ
* NOT USE 2008/09/17
*/
public class Mworkarea_taerror extends Mworkarea{
HashMap hm = new HashMap();
int emp_count = 0;
String dateshift = "";
public Mworkarea_taerror() {
super();
}
/**
* @see com.csc.library.session.DbRecord#postInqNext()
* ͡ employee table Memployee
*/
public void postInqNext(){
if (this.foundData()){
/*error_type = 0 ٴ
*error_type = 1 ٴ͡
*error_type = 2
*error_type = 6 Ҫ
*error_type = 11 ٴѵѹشҹ
*/
for (int i=0; i<=20; i++) {
this.hm.put("error_type_"+i, "0");
}
int emp_count=0;
int emp_error=0;
String errorType = "error_type_";
try {
DbInquiry inqEmp = (DbInquiry) this.getChild("memployee");
do {
DbRecord recEmp = inqEmp.getCurrentDbRecord();
if (recEmp.foundData()) {
String setDate = "";
if (this.param.containsKey("date_start") && this.param.containsKey("date_end")) {
CscCalendar cs1 = new CscCalendar((String) this.param.get("date_start"));
CscCalendar cs2 = new CscCalendar((String) this.param.get("date_end"));
setDate ="(dateshift between '"+cs1.getYYYYMMDD()+"' and '"+cs2.getYYYYMMDD()+"')";
} else if (this.param.containsKey("__date_start") && this.param.containsKey("__date_end")) {
CscCalendar cs1 = new CscCalendar((String) this.param.get("__date_start"));
CscCalendar cs2 = new CscCalendar((String) this.param.get("__date_end"));
setDate ="(dateshift between '"+cs1.getYYYYMMDD()+"' and '"+cs2.getYYYYMMDD()+"')";
} else {
CscCalendar cs = new CscCalendar();
setDate ="(dateshift between '"+cs.getYYYYMMDD()+"' and '"+cs.getYYYYMMDD()+"')";
}
String filter = setDate + " and employeeid ='"+recEmp.getString("employeeid")+"'" +
"and workarea='"+this.getString("workareaid")+"'";
int chk = 0;
DbInquiry inqError = new InitialInquiry(this.userPro).getDbInquiry();
inqError.setParam(this.param);
inqError.setSchemaName(this.userPro.getSchemaName());
inqError.initMyTable("TTIMEERROR", filter, "employeeid, line_no");
inqError.setFilter(filter);
inqError.setColumn("*");
inqError.refresh();
while (inqError.next()) {
DbRecord recError = inqError.getCurrentDbRecord();
if(recError.getString("error_type")!=null && !recError.getString("error_type").equals("")){
if(this.hm.containsKey(errorType+recError.getString("error_type"))){
int error_count = Integer.parseInt(this.hm.get(errorType+recError.getString("error_type")).toString()) + 1;
this.hm.put(errorType+recError.getString("error_type"), String.valueOf(error_count));
} else {
this.hm.put(errorType+recError.getString("error_type"), "1");
}
}
chk = 1;
}
if (chk==1) {
emp_error++;
}
emp_count++;
}
} while (inqEmp.next());
} catch (Exception e) {
MyLog.error(this, e);
}
this.hm.put("emp_count", String.valueOf(emp_count));
this.hm.put("emp_error", String.valueOf(emp_error));
}
}
public String getString(String field) {
if (this.hm.containsKey(field)){
return (String) this.hm.get(field);
} else return super.getString(field);
}
}
/*
* Created on 15 .. 2548
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.HashMap;
import com.csc.library.database.StaticProperties;
import com.csc.library.process.CalOT;
import com.csc.library.processmanager.EmployeeForProcess;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.InitialRecord;
import com.csc.library.session.RecordCmp;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utility.DiffTime;
import org.apache.log4j.Logger;
/**
* @author Sassyboy100
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Otformula extends RecordCmp {
public Otformula() {
super("Otformula", "Otformula Table");
}
public boolean preInsertTrigger() {
boolean result = true;
result = this.scanFieldFormula();
if (result == false) {
this.saveStatus = 14; // found error in formula
} else {
this.saveStatus = 3; // not found error
}
return result;
}
public boolean preUpdateTrigger() {
boolean result = true;
result = this.scanFieldFormula();
if (result == false) {
this.saveStatus = 14; // found error in formula
} else {
this.saveStatus = 3; // not found error
}
return result;
}
private boolean scanFieldFormula() {
String cond = super.getString("POLICY");
String formula = super.getString("FORMULA");
if ((cond == null) || (cond.equalsIgnoreCase(""))) {
//Log.info("Field Condition is null or empty String");
if ((formula == null) || (formula.equalsIgnoreCase(""))) {
//Log.info("Field Formula is null or empty String");
return true;
} else {
return this.chkFieldFormula(formula, "result");
}
} else {
if (this.chkFieldFormula(cond, "chk")) {
return this.chkFieldFormula(formula, "result");
} else
return false;
}
}
private DbRecord getEmployeeForFormula() {
try {
Memployee_ta emp = (Memployee_ta) new InitialRecord(this.userPro).getDbRecord("Memployee_ta");
emp.setParam("rsc_skip","true");
emp.setColumn("*");
emp.set("employeeid", (String)this.userPro.get("employeeid"));
if(emp.search()==1){
return emp;
}
} catch (Exception e) {
return null;
}
return null;
}
private Mtime0 getShiftForFormula(String code) {
try {
String filter="time0id='"+code+"'";
DbInquiry inq = new InitialInquiry(this.userPro).getDbInquiry();
inq.setSchemaName(this.userPro.getSchemaName());
inq.initMyTable("Mtime0",filter, "");
inq.setColumn("*");
inq.refresh();
while (inq.next()) {
return (Mtime0) inq.getCurrentDbRecord();
}
} catch (Exception e) {
//MyLog.error(this, e);
return null;
}
return null;
}
private Ttime_current1 getTimeForFormula() {
try {
DbRecord db = new InitialRecord(this.userPro).getDbRecord("ttime_current1");
db.setColumn("*");
return (Ttime_current1) db;
} catch (Exception e) {
MyLog.error(this, e);
return null;
}
}
private Ttime_current getTimeHeadForFormula() {
try {
DbRecord db = new InitialRecord(this.userPro).getDbRecord("ttime_current");
db.setColumn("*");
return (Ttime_current) db;
} catch (Exception e) {
MyLog.error(this, e);
return null;
}
}
private HashMap getHolidayorFormula(String code) {
HashMap hmHol = new HashMap();
try {
if (!code.equals("")) {
String filter = "holidayid='"+code+"'";
DbInquiry inqHoliday = new InitialInquiry(this.userPro).getDbInquiry();
inqHoliday.setParam(this.param);
inqHoliday.setSchemaName(this.userPro.getSchemaName());
inqHoliday.initMyTable("Mholiday1", filter, "");
inqHoliday.setColumn("*");
inqHoliday.refresh();
while (inqHoliday.next()) {
CscCalendar cs = new CscCalendar(inqHoliday.getString("hdate"));
hmHol.put(cs.getYYYYMMDD(), cs.getYYYYMMDD());
}
}
} catch (Exception e) {
//MyLog.error(this, e);
}
return hmHol;
}
private boolean chkFieldFormula(String interpret_string, String var_name) {
Memployee_ta emp = null;
Ttime_current1 time1=null;
Mtime0 shift=null;
HashMap hol=new HashMap();
Ttime_current time=null;
try {
emp = (Memployee_ta) this.getEmployeeForFormula();
time1 = this.getTimeForFormula();
shift = this.getShiftForFormula(emp.getString("time0"));
hol = this.getHolidayorFormula(shift.getString("holidaycode"));
time = this.getTimeHeadForFormula();
} catch (Exception ex) {
MyLog.error(this, ex);
}
CalOT cal = new CalOT();
cal.initValue(emp, time1, shift, new HashMap(), new HashMap(), time, new DiffTime(), StaticProperties.messagePools);
cal.run(interpret_string);
String result = cal.getDynamicJavaVariable(var_name).toString();
String err = cal.getErrorMsg();
if ((err == null) || (err.equalsIgnoreCase(""))) {
this.param.put("error_msg", "No Error");
this.param.put("formulaResult", result); // put result of formula to hash
return true;
} else {
if (err.length() > 99)
this.param.put("error_msg", err.substring(0, 99));
else
this.param.put("error_msg", err);
return false;
}
}
}
package com.csc.library.databean;
public class Sim1time0 extends Mtime0 {
public Sim1time0() {
super();
this.setActualName("mtime0");
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.formula.FormulaString;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.database.StaticConfig;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialRecord;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
public class Simmemployee_leave extends Memployee {
private String employeeid="";
MyHashMap hm_Col = new MyHashMap();
MyHashMap hm_mevent = new MyHashMap();
double hr_mtime0 = 0;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
this.hm_Col.clear();
MyLog.debug(this, "<<<<<<<<<<<<<<-- Simmemployee_leave -->>>>>>>>>>>>>>");
if(!this.getString("employeeid").equals("")){
if (this.param.isEmpty()) {
this.employeeid = this.getString("employeeid");
} else {
if (this.param.get("__employeeid")!=null) {
this.employeeid = (String) this.param.get("__employeeid");
} else this.employeeid = this.getString("employeeid");
}
this.selectEvent();
this.sumTime();
}
//MyLog.debug(this, "-->hm_Col="+hm_Col);
//MyLog.debug(this, "-->hm_mevent="+hm_mevent);
return temp;
}
private void selectEvent() {
try {
String limit = "";
FormulaString fs = new FormulaString();
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.setSchemaName(this.getUProfile().getSchemaName());
inq.initMyTable("meventgrp","daytype!='1' and daytype !='5' and daytype !='6' and daytype !='9' ","");
inq.setColumn("eventgrpid,companyid,edesc,tdesc,daytype,limit");
inq.refresh();
this.getHour_Day();
while (inq.next()) {
if (inq.getString("daytype").equalsIgnoreCase("7")) {
DbInquiry inqEmp = new InitialInquiry(this.getUProfile()).getDbInquiry();
inqEmp.initMyTable("memployee", "", "");
inqEmp.setColumn("employeeid,companyid,vacation0,vacation1");
inqEmp.setFilter("employeeid='" + this.employeeid + "'");
inqEmp.refresh();
int i=0;
if (inqEmp.next()) {
i = fs.DhmToM(inqEmp.getString("vacation0")) + fs.DhmToM(inqEmp.getString("vacation1"));
limit = fs.MTODhm(i);
}
} else {
limit = inq.getString("limit")+":00:00";
}
this.hm_Col.put(inq.getString("eventgrpid"), inq.getString("eventgrpid"));
this.hm_Col.put(inq.getString("eventgrpid") + "1", limit);//limit leave
this.hm_Col.put(inq.getString("eventgrpid") + "4", inq.getString("edesc"));//desc leave
this.hm_Col.put(inq.getString("eventgrpid") + "2", "00:00:00");//time leave
this.hm_Col.put(inq.getString("eventgrpid") + "3", limit);//ans of leave
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void sumTime() {
try {
CscCalendar cs = new CscCalendar();
String DateS = "", DateE = "";
if (this.param.containsKey("__date_start") && this.param.containsKey("__date_end")) {
MyLog.debug(this, "Date Rang From Screen Param !!!");
CscCalendar cs1 = new CscCalendar((String) this.param.get("__date_start"));
CscCalendar cs2 = new CscCalendar((String) this.param.get("__date_end"));
DateS = cs1.getYYYYMMDD();
DateE = cs2.getYYYYMMDD();
this.hm_Col.put("DATESTART", cs1.getDDMMYYYY());
this.hm_Col.put("DATEEND", cs2.getDDMMYYYY());
} else {
MyLog.debug(this, "Date Rang From Config !!!");
CscCalendar cs1 = new CscCalendar((String) StaticConfig.getConfigCompany(this.userPro, "ta1001"));
CscCalendar cs2 = new CscCalendar((String) StaticConfig.getConfigCompany(this.userPro, "ta1002"));
DateS = cs1.getYYYYMMDD();
DateE = cs2.getYYYYMMDD();
this.hm_Col.put("DATESTART", cs1.getDDMMYYYY());
this.hm_Col.put("DATEEND", cs2.getDDMMYYYY());
}
String sql = "employeeid= '" + this.employeeid + "'";
if (!DateS.equals("") && !DateE.equals("")) {
sql = sql + " and (dateid between'" + DateS + "' and '" + DateE + " ')";
}
MyLog.debug(this, "SQL >>>>>>>>>>>>>" + sql);
FormulaString fs = new FormulaString();
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable("tleave_summary", "", "");
inq.setColumn("*");
inq.setFilter(sql);
inq.refresh();
while (inq.next()) {
int a = 0;
String d = "", e = "";
if (inq.getString("lv_type").equals(this.hm_Col.get(inq.getString("lv_type")))) {
double s1 = 0f;
double h = 0f;
s1 = inq.getCurrentDbRecord().getDouble("m_lv");
if (this.hm_Col.containsKey(inq.getString("lv_type") + "2")) {
e = this.hm_Col.get(inq.getString("lv_type") + "2").toString();
a = fs.DhmToM(e) + fs.Tm_To_Min(s1);
} else {
a = fs.Tm_To_Min(s1);
}
d = fs.MTODhm(a, this.hr_mtime0);
this.hm_Col.put(inq.getString("lv_type") + "2", d);
this.subTime(inq.getString("lv_type"));
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void subTime(String a) {
FormulaString fs = new FormulaString();
String x = this.hm_Col.get(a + "1").toString();
String y = this.hm_Col.get(a + "2").toString();
int b = fs.DhmToM(x) - fs.DhmToM(y);
String z = fs.MTODhm(b,this.hr_mtime0);
this.hm_Col.put(a + "3", z);
}
private void getHour_Day() {
try {
DbInquiry inq1 = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq1.initMyTable("mtime0", "", "");
inq1.setColumn("time0id,companyid,edesc,tdesc,hour_d");
this.putChild(inq1);
this.refreshChild();
this.hr_mtime0 = Double.valueOf(inq1.getString("hour_d")).doubleValue();
MyLog.debug(this, "hour_d in mtime0 ------->>>" + this.hr_mtime0);
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hm_Col.get(fName) != null) {
return String.valueOf(this.hm_Col.get(fName));
}
}
return super.getString(fieldName);
}
}
\ No newline at end of file
/*
* Created on 16 .. 2547
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.formula.FormulaString;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.utilities.CscCalendar;
public class Simmemployee_tadjtime extends Memployee {
private String employeeid="";
MyHashMap hm_Col = new MyHashMap();
MyHashMap hm_mevent = new MyHashMap();
MyHashMap hm_hour_d = new MyHashMap();
double hr_mtime0 = 0;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
this.hm_Col.clear();
if(!this.getString("employeeid").equals("")){
if (this.param.containsKey("__runno") && this.param.containsKey("wf_id")) {
try {
String table = (String) this.param.get("wf_id");
String runno = (String) this.param.get("__runno");
if (table.equals("5"))
table = "TABSENTDATE0";
else if (table.equals("6"))
table = "TABSENT_M_DATE";
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable(table, "runno=" + runno, "");
inq.setColumn("employeeid,companyid,runno");
inq.refresh();
if (inq.next())
this.employeeid = inq.getString("employeeid");
} catch (Exception e) {
MyLog.error(this, e);
}
} else this.employeeid = (String) this.param.get("__employeeid");
}
this.selectEvent();
this.sumTime();
MyLog.debug(this, "-->hm_Col="+hm_Col);
MyLog.debug(this, "-->hm_mevent="+hm_mevent);
MyLog.debug(this, "-->hm_hour_d="+hm_hour_d);
return temp;
}
private void selectEvent() {
try {
String limit = "";
FormulaString fs = new FormulaString();
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.setSchemaName(this.getUProfile().getSchemaName());
inq.initMyTable( "meventgrp","daytype!='1' and daytype !='5' and daytype !='6' and daytype !='9' ","");
inq.setColumn("eventgrpid,companyid,edesc,tdesc,daytype,limit");
inq.refresh();
this.getHour_Day();
while (inq.next()) {
if (inq.getString("daytype").equalsIgnoreCase("7")) {
//MyLog.debug(this, "<------------vacation------------>");
DbInquiry inqEmp = new InitialInquiry(this.getUProfile()).getDbInquiry();
inqEmp.initMyTable("memployee", "", "");
inqEmp.setColumn("memployeeid,companyid,vacation0,vacation1");
inqEmp.setFilter("employeeid='" + this.employeeid + "'");
inqEmp.refresh();
int i=0;
if (inqEmp.next())
MyLog.debug(this, " >>>>>>>>>> vacation0="+inqEmp.getString("vacation0"));
MyLog.debug(this, " >>>>>>>>>> vacation1="+inqEmp.getString("vacation1"));
i = fs.DhmToM(inqEmp.getString("vacation0")) + fs.DhmToM(inqEmp.getString("vacation1"));
limit = fs.MTODhm(i);
} else {
//MyLog.debug(this, "<------------limit------------>");
limit = inq.getString("limit")+":0:0";
}
//MyLog.debug(this, "code----------->>>> " +
// inq.getString("eventgrpid") + " >>> limit=" + limit);
//MyLog.debug(this, "<----eventgrpid---->" +
// inq.getString("eventgrpid"));
this.hm_Col.put(inq.getString("eventgrpid"), inq.getString("eventgrpid"));
this.hm_Col.put(inq.getString("eventgrpid") + "1", limit);//limit leave
this.hm_Col.put(inq.getString("eventgrpid") + "4", inq.getString("edesc"));//desc leave
this.hm_Col.put(inq.getString("eventgrpid") + "2", "0:0:0");//time leave
this.hm_Col.put(inq.getString("eventgrpid") + "3", limit);//ans of leave
//MyLog.debug(this, "<----eventgrpidH---->" +
// this.hm_Col.get(inq.getString("eventgrpid")));
//MyLog.debug(this, "<----eventgrpidL---->" +
// this.hm_Col.get(inq.getString("eventgrpid") + "1"));
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void sumTime() {
try {
// ### comment by pae 8-2-2005 ####
CscCalendar cs = new CscCalendar();
String DateS = ""; String DateE = "";
String pDateStart = ""; String pDateEnd = "";
if (this.param.containsKey("__date_start") && this.param.containsKey("__date_end")) {
pDateStart = (String) this.param.get("__date_start");
pDateEnd = (String) this.param.get("__date_end");
MyLog.debug(this, "param__date--->" + pDateStart + " <->" + pDateEnd);
if (!pDateStart.trim().equals("") && !pDateEnd.trim().equals("")) {
DateS = pDateStart;
DateE = pDateEnd;
}
if (!pDateStart.trim().equals("") && pDateEnd.trim().equals("")) {
DateS = pDateStart;
DateE = cs.getYYYYMMDD();
}
if (pDateStart.trim().equals("") && pDateEnd.trim().equals("")) {
DateS = cs.getYear() + "-" + cs.getMM() + "-01";
DateE = cs.getYYYYMMDD();
}
}
String sql = "employeeid= '" + employeeid + "'";
if (!DateS.equals("")&&!DateE.equals("")) {
sql += " and (dt_bg between'" + DateS + "' and '" + DateE + " ')";
sql += " and updtype='A'";
}
MyLog.debug(this, "SQL >>>>>>>>>>>>>" + sql);
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable("tadjtime0", "", "");
inq.setColumn("employeeid,companyid,docdate,doctype,lv_ty,lv,tr_type,eventgrp,dt_bg");
inq.setFilter(sql);
inq.refresh();
FormulaString fs = new FormulaString();
while (inq.next()) {
int a = 0;
String d = "", e = "";
//MyLog.debug(this, "--------------eventgrp-------------> "+inq.getString("eventgrp")+" *****");
if (inq.getString("eventgrp").equals(this.hm_Col.get(inq.getString("eventgrp")))) {
//MyLog.debug(this, "eventgrp---->>>>>>" + this.hm_Col.get(inq.getString("eventgrp")) + "doctype---> " + inq.getString("doctype"));
if ((inq.getString("doctype").trim().equals("A") || inq.getString("doctype").trim().equals("S"))) {
//MyLog.debug(this, "doctype---->"+ inq.getString("doctype"));
double s1 = 0f;
double h = 0f;
//s1 = Double.valueOf(inq.getString("m_lv")) .doubleValue();
s1 = inq.getCurrentDbRecord().getDouble("lv");
//MyLog.debug(this, "eventgrp2-->" + this.hm_Col.get(inq.getString("eventgrp") + "2"));
//MyLog.debug(this, "tr_type<>updtype-->" + inq.getString("tr_type") + "<->" + inq.getString("updtype"));
if (this.hm_Col.containsKey(inq.getString("eventgrp") + "2")) {
e = this.hm_Col.get(inq.getString("eventgrp") + "2").toString();
//MyLog.debug(this, "befor SUM------->>>" + fs.DhmToM(e) + " + " + fs.times(s1));
a = fs.DhmToM(e) + fs.times(s1);
} else {
a = fs.times(s1);
}
d = fs.MTODhm(a);
this.hm_Col.put(inq.getString("eventgrp") + "2", d);
//MyLog.debug(this, "sum-------->" + this.hm_Col.get(inq.getString("eventgrp") + "2"));
this.subTime(inq.getString("eventgrp"));
}
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void subTime(String a) {
FormulaString fs = new FormulaString();
String x = this.hm_Col.get(a + "1").toString();
String y = this.hm_Col.get(a + "2").toString();
int b = fs.DhmToM(x) - fs.DhmToM(y);
//MyLog.debug(this, "Ans-->" + x + "-" + y + "<---Limit_LV---->" + b);
String z = fs.MTODhm(b);
//MyLog.debug(this, "MMM--->" + z);
this.hm_Col.put(a + "3", z);
}
private String lToL(String a) {
FormulaString fs = new FormulaString();
return fs.MTODhm(fs.DhmToM(a, this.hr_mtime0), this.hr_mtime0);
}
private void getHour_Day() {
try {
DbInquiry inq1 = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq1.initMyTable("mtime0", "", "");
inq1.setColumn("time0id,companyid,edesc,tdesc,hour_d");
inq1.refresh();
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable("memployee", "", "");
inq.setColumn("memployeeid,companyid,time0");
inq.setFilter("employeeid='" + this.employeeid + "'");
inq.putChild(inq1);
inq.refresh();
inq.next();
this.hr_mtime0 = Double.valueOf(inq.getString("mtime0", "hour_d")).doubleValue();
MyLog.debug(this, "hour_d------->>>" + this.hr_mtime0);
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
//MyLog.debug(this, "fieldName ----------> " + fieldName);
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
//MyLog.debug(this, "fieldNameChild ----------> " + fieldName);
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hm_Col.get(fName) != null) {
return String.valueOf(this.hm_Col.get(fName));
}
}
return super.getString(fieldName);
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.formula.FormulaString;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.InitialRecord;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.CscTime;
public class Simmemployee_tadjtime0 extends Memployee {
private String employeeid="";
MyHashMap hm_Col = new MyHashMap();
MyHashMap hm_mevent = new MyHashMap();
MyHashMap hm_hour_d = new MyHashMap();
double hr_mtime0 = 0;
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
this.hm_Col.clear();
MyLog.debug(this, "<<<<<<<<<<<<<<-- Simmemployee_tadjtime0 -->>>>>>>>>>>>>>");
if(!this.getString("employeeid").equals("")){
if (this.param.isEmpty()) {
this.employeeid = this.getString("employeeid");
} else {
if (this.param.containsKey("__runno") && this.param.containsKey("wf_id")) {
MyLog.debug(this, "<-----------workflow-------------->");
try {
String table = (String) this.param.get("wf_id");
String runno = (String) this.param.get("__runno");
if (table.equals("5"))
table = "TABSENTDATE0";
else if (table.equals("6"))
table = "TABSENT_M_DATE";
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable(table, "runno=" + runno, "");
inq.setColumn("employeeid,companyid,runno");
inq.refresh();
if (inq.next())
this.employeeid = inq.getString("employeeid");
} catch (Exception e) {
MyLog.error(this, e);
}
} else {
if (this.param.get("__employeeid")!=null) {
this.employeeid = (String) this.param.get("__employeeid");
} else this.employeeid = this.getString("employeeid");
}
}
this.selectEvent();
this.sumTime();
}
//MyLog.debug(this, "-->hm_Col="+hm_Col);
//MyLog.debug(this, "-->hm_mevent="+hm_mevent);
//MyLog.debug(this, "-->hm_hour_d="+hm_hour_d);
return temp;
}
private void selectEvent() {
try {
String limit = "";
FormulaString fs = new FormulaString();
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.setSchemaName(this.getUProfile().getSchemaName());
inq.initMyTable("meventgrp","daytype!='1' and daytype !='5' and daytype !='6' and daytype !='9' ","");
inq.setColumn("eventgrpid,companyid,edesc,tdesc,daytype,limit");
inq.refresh();
this.getHour_Day();
while (inq.next()) {
if (inq.getString("daytype").equalsIgnoreCase("7")) {
//MyLog.debug(this, "<------------vacation------------>");
DbInquiry inqEmp = new InitialInquiry(this.getUProfile()).getDbInquiry();
inqEmp.initMyTable("memployee", "", "");
inqEmp.setColumn("employeeid,companyid,vacation0,vacation1,vacationcode");
inqEmp.setFilter("employeeid='" + this.employeeid + "'");
inqEmp.refresh();
int i=0;
if (inqEmp.next()) {
//MyLog.debug(this, " >>>>>>>>>> vacation0="+inqEmp.getString("vacation0"));
//MyLog.debug(this, " >>>>>>>>>> vacation1="+inqEmp.getString("vacation1"));
i = fs.DhmToM(inqEmp.getString("vacation0")) + fs.DhmToM(inqEmp.getString("vacation1"));
limit = fs.MTODhm(i);
}
} else {
limit = inq.getString("limit")+":0:0";
}
this.hm_Col.put(inq.getString("eventgrpid"), inq.getString("eventgrpid"));
this.hm_Col.put(inq.getString("eventgrpid") + "1", limit);//limit leave
this.hm_Col.put(inq.getString("eventgrpid") + "4", inq.getString("edesc"));//desc leave
this.hm_Col.put(inq.getString("eventgrpid") + "2", "0:0:0");//time leave
this.hm_Col.put(inq.getString("eventgrpid") + "3", limit);//ans of leave
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void sumTime() {
try {
// ### comment by pae 8-2-2005 ####
CscCalendar cs = new CscCalendar();
String DateS = "", DateE = "";
String pDateStart = "";
String pDateEnd = "";
// MyLog.debug(this, "StartDate -->> "+this.param.get("__date_start"));
// MyLog.debug(this, "EndDate -->> "+this.param.get("__date_end"));
if (this.param.containsKey("__date_start")
&& this.param.containsKey("__date_end")) {
pDateStart = (String) this.param.get("__date_start");
pDateEnd = (String) this.param.get("__date_end");
// MyLog.debug(this, "param__date--->" + pDateStart + " <->" + pDateEnd);
if (!pDateEnd.trim().equals("")) {
DateE = pDateEnd;
}
if (!pDateStart.trim().equals("")) {
DateS = pDateStart;
}
if (pDateStart.trim().equals("") && pDateEnd.trim().equals("")) {
MyLog.debug(this, "Date from screen is Empty !!!");
CscCalendar date = new CscCalendar();
DateS = date.getYear() + "-01-01";
DateE = date.getYYYYMMDD();
CscCalendar cs1 = new CscCalendar(DateS);
CscCalendar cs2 = new CscCalendar(DateE);
DateS = cs1.getYYYYMMDD();
DateE = cs2.getYYYYMMDD();
this.hm_Col.put("DateStart", cs1.getDDMMYYYY());
this.hm_Col.put("DateEnd", cs2.getDDMMYYYY());
}
} else {
System.out .println("Date from screen is Empty <param is null> !!!");
CscCalendar date = new CscCalendar();
DateS = date.getYear() + "-01-01";
DateE = date.getYYYYMMDD();
CscCalendar cs1 = new CscCalendar(DateS);
CscCalendar cs2 = new CscCalendar(DateE);
DateS = cs1.getYYYYMMDD();
DateE = cs2.getYYYYMMDD();
this.hm_Col.put("DateStart", cs1.getDDMMYYYY());
this.hm_Col.put("DateEnd", cs2.getDDMMYYYY());
}
String sql = "employeeid= '" + this.employeeid + "'";
if (!DateS.equals("") && !DateE.equals("")) {
sql = sql + " and (m_dt_bg between'" + DateS + "' and '" + DateE + " ')";
}
MyLog.debug(this, "SQL >>>>>>>>>>>>>" + sql);
CscTime late = new CscTime(0);
int late_count=0;
DbInquiry inq = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq.initMyTable("ttime_current1", "", "");
inq.setColumn("employeeid,companyid,dateid,doctype,lv_ty,m_lv,tr_type,eventgrp,lt");
inq.setFilter(sql);
inq.refresh();
FormulaString fs = new FormulaString();
while (inq.next()) {
int a = 0;
String d = "", e = "";
if (inq.getString("eventgrp").equals(this.hm_Col.get(inq.getString("eventgrp")))) {
double s1 = 0f;
double h = 0f;
s1 = inq.getCurrentDbRecord().getDouble("m_lv");
if (this.hm_Col.containsKey(inq.getString("eventgrp") + "2")) {
e = this.hm_Col.get(inq.getString("eventgrp") + "2").toString();
a = fs.DhmToM(e) + fs.Tm_To_Min(s1);
} else {
a = fs.Tm_To_Min(s1);
}
d = fs.MTODhm(a, this.hr_mtime0);
this.hm_Col.put(inq.getString("eventgrp") + "2", d);
this.subTime(inq.getString("eventgrp"));
}
if (inq.getCurrentDbRecord().getFloat("lt")>0) {
late_count++;
late.add(inq.getCurrentDbRecord().getFloat("lt"));
}
}
this.hm_Col.put("late_count", late_count);
this.hm_Col.put("late_time", late.getFloat());
} catch (Exception e) {
MyLog.error(this, e);
}
}
private void subTime(String a) {
FormulaString fs = new FormulaString();
String x = this.hm_Col.get(a + "1").toString();
String y = this.hm_Col.get(a + "2").toString();
int b = fs.DhmToM(x) - fs.DhmToM(y);
String z = fs.MTODhm(b,this.hr_mtime0);
this.hm_Col.put(a + "3", z);
}
private void getHour_Day() {
try {
DbInquiry inq1 = new InitialInquiry(this.getUProfile()).getDbInquiry();
inq1.initMyTable("mtime0", "", "");
inq1.setColumn("time0id,companyid,edesc,tdesc,hour_d");
this.putChild(inq1);
this.refreshChild();
this.hr_mtime0 = Double.valueOf(inq1.getString("hour_d")).doubleValue();
MyLog.debug(this, "hour_d in mtime0 ------->>>" + this.hr_mtime0);
} catch (Exception e) {
MyLog.error(this, e);
}
}
public String getString(String fieldName) {
if (fieldName.indexOf("$") > 0) {
return this.getStringChild(fieldName);
} else {
return super.getString(fieldName);
}
}
private String getStringChild(String fieldName) {
if (fieldName.indexOf("$") > 0) {
String tName = fieldName.substring(0, fieldName.indexOf("$"));
String fName = fieldName.substring(fieldName.indexOf("$") + 1, fieldName.length());
if (this.hm_Col.get(fName) != null) {
return String.valueOf(this.hm_Col.get(fName));
}
}
return super.getString(fieldName);
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import com.csc.library.database.ChildManager;
import com.csc.library.session.DbRecord;
import com.csc.library.session.DbTable;
/*
* ˹Ҩ͵ҧ÷ӧҹ
* ͷӡҧҧ÷ӧҹ 7 ѹ -
*/
public class Simtime0 extends Mtime0 {
public Simtime0() {
super();
this.setActualName("Simtime0");
}
public int putChild(ChildManager oChild) {
int point = super.putChild(oChild);
int lineno = 1;
try {
if ((oChild instanceof DbTable) && (oChild.getTableName().equalsIgnoreCase("MTIME1"))) {
DbTable dbTable = (DbTable) oChild;
for (int i = 0; i < 7; i++) {
int j = i + 1;
DbRecord rec = dbTable.getNewRecord();
rec.set("TIME0ID", this.getString("TIME0ID"));
rec.set("DAYWEEKID", j);
rec.set("COMPANYID", this.getUProfile().get("companyid"));
rec.set("STOPDAY", 0);
rec.set("HOUR_D", "0.00");
rec.set("TIMEIN1", "0.00");
rec.set("TIMEIN2", "0.00");
rec.set("TIMEOUT1", "0.00");
rec.set("TIMEOUT2", "0.00");
rec.set(dbTable.getMinorKey(), lineno++);
dbTable.putNewRecord(rec);
}
}
} catch (Exception ex) {
MyLog.error(this, ex);
}
return point;
}
/*protected void postInsertTrigger() throws Exception {
super.postInsertTrigger();
try {
DbTable dbTable = (DbTable) this.getChild("mtime1");
dbTable.first();
do {
DbRecord rec = dbTable.getCurrentRecordManager();
rec.set("STOPDAY", 0);
rec.set("HOUR_D", "0.00");
rec.set("TIMEIN1", "0.00");
rec.set("TIMEIN2", "0.00");
rec.set("TIMEOUT1", "0.00");
rec.set("TIMEOUT2", "0.00");
dbTable.next();
} while (!dbTable.eof());
} catch (Exception e) {
e.printStackTrace();
}
}
protected void postUpdateTrigger() throws Exception {
super.postUpdateTrigger();
try {
DbTable dbTable = (DbTable) this.getChild("mtime1");
dbTable.first();
do {
DbRecord rec = dbTable.getCurrentRecordManager();
rec.set("STOPDAY", 0);
rec.set("HOUR_D", "0.00");
rec.set("TIMEIN1", "0.00");
rec.set("TIMEIN2", "0.00");
rec.set("TIMEOUT1", "0.00");
rec.set("TIMEOUT2", "0.00");
dbTable.next();
} while (!dbTable.eof());
} catch (Exception e) {
e.printStackTrace();
}
}*/
}
\ No newline at end of file
package com.csc.library.databean;
public class Simtime1 extends Mtime1 {
public Simtime1() {
super();
this.setActualName("Simtime1");
}
}
\ No newline at end of file
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.Vector;
import java.util.Enumeration;
import com.csc.library.approve.Organization;
import com.csc.library.database.ChildManager;
import com.csc.library.session.*;
public class Simtot0 extends Tot0 {
public Simtot0() {
super();
}
public int putChild(ChildManager oChild) {
int point = super.putChild(oChild);
try {
if ((oChild instanceof DbTable) && (oChild.getTableName().equalsIgnoreCase("TOT1"))) {
DbTable dbTable = (DbTable) oChild;
String empid = (String) this.getUProfile().get("actor");
Organization org = (Organization) new InitialRecord(this.userPro, this.param).getDbRecord("Masfactor");
org.setDaTaResult("Torgani","bossid,employeeid,companyid,runno");
org.setSub("1", "employeeid", "bossid", empid);
Vector subOrdi = new Vector();
subOrdi = org.getSub();
DbRecord rec;
DbRecord subBean;
for (Enumeration e = subOrdi.elements(); e.hasMoreElements();) {
rec = dbTable.getNewRecord();
subBean = (DbRecord) e.nextElement();
rec.set("otid", this.getString("otid"));
rec.set("employeeid", subBean.getString("employeeid"));
dbTable.putNewRecord(rec);
}
}
} catch (Exception ex) {
MyLog.error(this, ex);
}
return point;
}
}
\ No newline at end of file
/*
* Created on 11 .. 2548
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.csc.library.databean;
import com.csc.library.utilities.MyLog;
import java.util.Iterator;
import com.csc.library.database.DataSet;
import com.csc.library.database.MyHashMap;
import com.csc.library.formula.FormulaString;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialInquiry;
/**
* @author XeroX
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Simttime_current12 extends Ttime_current1_decimal {
MyHashMap hm_Data = new MyHashMap();
MyHashMap hm_Head = null;
int countCol = 0;
boolean flag=false;
public Simttime_current12() {
super();
}
public int assignField(DataSet rs) {
int temp = super.assignField(rs);
if (!this.getString("employeeid").equalsIgnoreCase("")) {
if (this.flag==false) {
countCol = 0;
this.hm_Head = new MyHashMap();
this.getDataML();
this.flag=true;
}
this.getDataMV();
this.setDataCol();
//MyLog.debug(this, "hm_Head==="+this.hm_Head);
//MyLog.debug(this, "hm_Data==="+this.hm_Data);
}
return temp;
}
public void getDataML() {
try {
String codecol = "", sql = "", key = "", sqlMev = "", lang = "ENG";
if (this.param.containsKey("CODEID")) {
String code = (String) this.param.get("CODEID");
if (!code.trim().equals("")) {
codecol = code;
sql = "codeid = '" + codecol + "'";
}
}
DbInquiry in1 = new InitialInquiry(this.getUProfile()).getDbInquiry();
in1.initMyTable("Mleave_report", "", "");
in1.setColumn("*");
in1.setFilter(sql);
in1.refresh();
in1.next();
for (int i = 1; i <= 5; i++) {
if (!in1.getString("col0" + i).equals("")) {
this.hm_Head.put("col_id0" + i, in1.getString("col0" + i));
++countCol;
if (i == 1) {
key += "'" + in1.getString("col0" + i) + "'";
} else {
key += ",'" + in1.getString("col0" + i) + "'";
}
}
}
if (this.param.containsKey("LANGUAGE")) {
String codeL = (String) this.param.get("LANGUAGE");
if (!codeL.trim().equals("")) {
lang = codeL;
}
}
sqlMev = "eventgrpid in (" + key + ")";
DbInquiry in2 = new InitialInquiry(this.getUProfile()).getDbInquiry();
in2.initMyTable("Meventgrp", "", "");
in2.setColumn("eventgrpid,companyid,edesc,tdesc");
in2.setFilter(sqlMev);
in2.refresh();
while (in2.next()) {
if (lang.trim().equalsIgnoreCase("ENG")) {
this.hm_Head.put(in2.getString("eventgrpid"), in2.getString("edesc"));
} else {
this.hm_Head.put(in2.getString("eventgrpid"), in2.getString("tdesc"));
}
}
} catch (Exception e) {
MyLog.error(this, e);
}
}
public void getDataMV() {
for (int i = 1; i <= countCol; i++) {
if (this.hm_Head.get(this.hm_Head .get("col_id0" + i))!=null) {
this.hm_Data.put("col0" + i, this.hm_Head.get(this.hm_Head.get("col_id0" + i)));
} else this.hm_Data.put("col0" + i,"");
this.hm_Data.put("data0" + i, 0.00);
}
}
public void setDataCol() {
boolean dataL = true;
for (int i = 1; i <= countCol; i++) {
if (this.hm_Head.get("col_id0" + i).toString().equalsIgnoreCase(this.getString("lv_ty"))) {
this.hm_Data.put("data0" + i, this.getDouble("m_lv_decimal"));
dataL = false;
}
}
if (dataL== true) {
this.hm_Data.put("dataetc", this.getDouble("m_lv_decimal"));
} else {
this.hm_Data.put("dataetc", 0.00);
}
}
public String getString(String field) {
try {
if (this.hm_Data.containsKey(field)) {
return this.hm_Data.get(field).toString();
} else {
return super.getString(field);
}
} catch (RuntimeException e) {
MyLog.error(this, e);
MyLog.debug(this, "error="+field);
return "";
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment