public void get_cashdenomination(cls_user cashier, int type) { string branchid = cls_globalvariables.BranchCode; string terminalno = cls_globalvariables.terminalno_v; long userwid = cashier.getsyncid(); string sSQL = @"SELECT * FROM `poscashdenomination` WHERE `branchid` = " + branchid + @" AND `terminalno` = " + terminalno + @" AND DATE(`datecreated`) = DATE(NOW()) AND `type` = " + type + @" ORDER BY `datecreated` DESC LIMIT 1"; DataTable dt = mySQLFunc.getdb(sSQL); if (dt.Rows.Count <= 0) { return; } DataRow dr = dt.Rows[0]; this.cash_1000 = Convert.ToInt32(dr["b1000"]); this.cash_500 = Convert.ToInt32(dr["b500"]); this.cash_200 = Convert.ToInt32(dr["b200"]); this.cash_100 = Convert.ToInt32(dr["b100"]); this.cash_50 = Convert.ToInt32(dr["b50"]); this.cash_20 = Convert.ToInt32(dr["b20"]); this.cash_10 = Convert.ToInt32(dr["c10"]); this.cash_5 = Convert.ToInt32(dr["c5"]); this.cash_1 = Convert.ToInt32(dr["c1"]); this.cash_25c = Convert.ToInt32(dr["c25c"]); this.cash_10c = Convert.ToInt32(dr["c10c"]); this.cash_5c = Convert.ToInt32(dr["c5c"]); this.type = 0; }
public void save_cashdenomination(cls_user cashier) { //type: //1 - beginning //2 - pickup //3 - ending mySQLClass mysqlclass = new mySQLClass(); string branchid = cls_globalvariables.BranchCode; string terminalno = cls_globalvariables.terminalno_v; long userwid = cashier.getsyncid(); long SyncId = mysqlclass.GetAndInsertNextSyncId("poscashdenomination"); if (this.get_type() == 3) { mySQLFunc.setdb(@"UPDATE `poscashdenomination` SET `type` = 2 WHERE `type` = 3 AND CAST(`datecreated` AS DATE) = CAST(NOW() AS DATE) AND `branchid` = " + branchid + @" AND `terminalno` = " + terminalno); } string sSQL = @"UPDATE `poscashdenomination` SET `branchid` = " + branchid + ", `terminalno` = " + terminalno + ", `userid` = " + userwid + ", `datecreated` = NOW(), `type` = " + this.get_type() + ", `b1000` = " + this.getCash_1000() + ", `b500` = " + this.getCash_500() + ", `b200` = " + this.getCash_200() + ", `b100` = " + this.getCash_100() + ", `b50` = " + this.getCash_50() + ", `b20` = " + this.getCash_20() + ", `c10` = " + this.getCash_10() + ", `c5` = " + this.getCash_5() + ", `c1` = " + this.getCash_1() + ", `c25c` = " + this.getCash_25c() + ", `c10c` = " + this.getCash_10c() + ", `c5c` = " + this.getCash_5c() + @" WHERE `SyncId` = " + SyncId + " LIMIT 1"; //Console.WriteLine(sSQL); mySQLFunc.setdb(sSQL); mysqlclass.update_synctable("poscashdenomination", SyncId); }