示例#1
0
        public virtual bool ApproveStockCount(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn, int shopId, int staffId, string remark, List <Material> materialList)
        {
            if (materialList.Count > 0)
            {
                // Gen Diff Doc
                AdjustDocument adjustDocument = new AdjustDocument(this.DocumentDate);
                adjustDocument.CreateAdjustMonthlyDocument(dbUtil, conn, this.DocumentId, materialList, remark, shopId, staffId);
            }

            dbUtil.sqlExecute(" DELETE FROM docdetail WHERE DocumentID=" + this.DocumentId + " AND ShopID=" + shopId, conn);
            string sql = " INSERT INTO docdetail (DocDetailID, DocumentID, ShopID, ProductID, ProductUnit, ProductAmount, " +
                         " ProductTaxType, UnitName, UnitSmallAmount, UnitID) " +
                         " SELECT DocDetailID, DocumentID, ShopID, ProductID, ProductUnit, ProductAmount, " +
                         " ProductTaxType, UnitName, UnitSmallAmount, UnitID " +
                         " FROM docdetailtemp WHERE DocumentID=" + this.DocumentId + " AND ShopID=" + shopId + " AND DocumentTypeID= " + this.DocumentTypeId;

            if (dbUtil.sqlExecute(sql, conn) > 0)
            {
                dbUtil.sqlExecute("UPDATE document SET DocumentStatus=2, UpdateBy=" + staffId + ", ApproveBy=" + staffId + ", " +
                                  " UpdateDate='" + DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss", dateProvider) + "', " +
                                  " ApproveDate='" + DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss", dateProvider) + "'" +
                                  " WHERE DocumentID=" + this.DocumentId + " AND ShopID=" + shopId + " AND DocumentTypeID=" + this.DocumentTypeId, conn);
                dbUtil.sqlExecute("DELETE FROM docdetailtemp WHERE DocumentID=" + this.DocumentId + " AND ShopID=" + shopId + " AND DocumentTypeID=" + this.DocumentTypeId, conn);
                return(true);
            }
            return(false);
        }
示例#2
0
        // overload 2/9/2011 fix load history in new month
        public bool CheckMonthlyDocIsApprove(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn,
                                             DateTime dateFrom, DateTime dateTo)
        {
            this.DocumentTypeId = 7;
            string sql = " SELECT DocumentDate, DocumentID FROM document WHERE documenttypeid=" + this.DocumentTypeId + " AND shopid=" + this.ShopId +
                         " AND DocumentStatus=1 AND DocumentDate BETWEEN '" + dateFrom.ToString("yyyy-MM-dd", dateProvider) + "' AND '" + dateTo.ToString("yyyy-MM-dd", dateProvider) + "'";

            MySql.Data.MySqlClient.MySqlDataReader reader = dbUtil.sqlRetrive(sql, conn);
            if (reader.Read())
            {
                this.DocumentDate = reader.GetDateTime("DocumentDate");
                this.DocumentId   = reader.GetInt32("DocumentID");
                reader.Close();
                return(false); // Approved
            }
            else
            {
                sql = " SELECT DocumentDate, DocumentID FROM document WHERE documenttypeid=" + this.DocumentTypeId + " AND shopid=" + this.ShopId +
                      " AND DocumentStatus=2 AND DocumentDate BETWEEN '" + dateFrom.ToString("yyyy-MM-dd", dateProvider) + "' AND '" + dateTo.ToString("yyyy-MM-dd", dateProvider) + "'";
                reader.Close();
                reader = dbUtil.sqlRetrive(sql, conn);
                if (reader.Read())
                {
                    this.DocumentDate = reader.GetDateTime("DocumentDate");
                    this.DocumentId   = reader.GetInt32("DocumentID");
                    reader.Close();
                    return(true); // Not Approve
                }
                else
                {
                    reader.Close();
                }
            }
            return(false);
        }
示例#3
0
 public override bool AddDocument(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn)
 {
     return(base.AddDocument(dbUtil, conn));
 }
示例#4
0
 public override bool SaveCountData(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn, int staffId, List <Material> materialList)
 {
     //this.DocumentId = base.DocumentId;
     return(base.SaveCountData(dbUtil, conn, staffId, materialList));
 }
示例#5
0
 public override bool GetLastCountDate(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn, int invId, ref DateTime lastCountDate)
 {
     return(base.GetLastCountDate(dbUtil, conn, invId, ref lastCountDate));
 }
示例#6
0
 public override bool CheckTransferDocument(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn, int inv, ref DateTime lastTransferDate)
 {
     return(base.CheckTransferDocument(dbUtil, conn, inv, ref lastTransferDate));
 }