Ejemplo n.º 1
0
        public static List <proformainvoice> getProformaInfo(int TempNo, string DOCID)
        {
            proformainvoice        documentrec;
            List <proformainvoice> Documents = new List <proformainvoice>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "Select b.Name,a.InvoiceAmount,a.InvoiceNo,a.InvoiceDate,a.TemporaryDate from InvoiceOutHeader a,Customer b where b.CustomerID=a.Consignee and a.DocumentID='" + DOCID + "' and a.TemporaryNo='" + TempNo + "'";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    documentrec = new proformainvoice();
                    documentrec.customername  = reader.GetString(0);
                    documentrec.InvoiceAmt    = reader.GetDouble(1);
                    documentrec.DocumentNo    = reader.GetInt32(2);
                    documentrec.DocumentDate  = reader.GetDateTime(3);
                    documentrec.TemporaryDate = reader.GetDateTime(4);
                    Documents.Add(documentrec);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(Documents);
        }
Ejemplo n.º 2
0
        public List <proformainvoice> getProformaDocuments()
        {
            proformainvoice        documentrec;
            List <proformainvoice> Documents = new List <proformainvoice>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "Select DocumentID,TemporaryNo,TemporaryDate,DocumentNo,DocumentDate from ProformaDocuments order by TemporaryNo";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    documentrec               = new proformainvoice();
                    documentrec.DocumentID    = reader.GetString(0);
                    documentrec.TemporaryNo   = reader.GetInt32(1);
                    documentrec.TemporaryDate = reader.GetDateTime(2);
                    documentrec.DocumentNo    = reader.GetInt32(3);
                    documentrec.DocumentDate  = reader.GetDateTime(4);
                    Documents.Add(documentrec);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(Documents);
        }
Ejemplo n.º 3
0
        public Boolean insertDocument(proformainvoice doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into ProformaDocuments (DocumentID,TemporaryNo,TemporaryDate,DocumentNo,DocumentDate,CreateTime,CreateUser)" +
                                     "values (" +
                                     "'" + doc.DocumentID + "'," +
                                     "'" + doc.TemporaryNo + "'," +
                                     "'" + doc.TemporaryDate.ToString("yyyy-MM-dd") + "'," +
                                     doc.DocumentNo + "," +
                                     "'" + doc.DocumentDate.ToString("yyyy-MM-dd") + "'," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "ProformaDocuments", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
Ejemplo n.º 4
0
        public Boolean validateDocument(proformainvoice doc)
        {
            Boolean status = true;

            try
            {
                if (doc.DocumentNo == 0)
                {
                    return(false);
                }
                if (doc.DocumentDate == DateTime.MinValue)
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                return(false);
            }

            return(status);
        }