예제 #1
0
        public bool GetWebUpdate()
        {
            bool result = false;

            try
            {
                string s = "UPDATE TBL_TRANSFTERDISPLAYDATETIME SET WLDbStatus='1' WHERE ID=@ID";

                SqlParameter spID = new SqlParameter();
                spID.ParameterName = "@ID";
                spID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spID.Value         = this.ID;

                WebConnecString.ConString = WebConnString();
                WebConnecString.CmdType   = CommandType.Text;
                WebConnecString.CmdString = s;
                WebConnecString.InsertRecord(spID);

                //local update

                SqlCeParameter spID1 = new SqlCeParameter();
                spID1.ParameterName = "@ID";
                spID1.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spID1.Value         = this.ID;

                LocConnecString.ConString = LocalConnString();
                LocConnecString.CmdType   = CommandType.Text;
                LocConnecString.CmdString = s;
                LocConnecString.InsertRecord(spID1);

                result = true;
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
예제 #2
0
        public void InsertTenderDtls()
        {
            try
            {
                SqlParameter spDocumentID = new SqlParameter();
                spDocumentID.ParameterName = "@DocumentID";
                spDocumentID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spDocumentID.Value         = DocumentID;

                SqlParameter spLocationID = new SqlParameter();
                spLocationID.ParameterName = "@LocationID";
                spLocationID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationID.Value         = LocationID;

                SqlParameter spTerminalID = new SqlParameter();
                spTerminalID.ParameterName = "@TerminalID";
                spTerminalID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTerminalID.Value         = TerminalID;

                SqlParameter spCompanyID = new SqlParameter();
                spCompanyID.ParameterName = "@CompanyID";
                spCompanyID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCompanyID.Value         = CompanyID;

                SqlParameter spStorageID = new SqlParameter();
                spStorageID.ParameterName = "@StorageID";
                spStorageID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spStorageID.Value         = StorageID;

                SqlParameter spCustomerID = new SqlParameter();
                spCustomerID.ParameterName = "@CustomerID";
                spCustomerID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                if (!CustomerID.Equals(string.Empty))
                {
                    spCustomerID.Value = CustomerID;
                }
                else
                {
                    spCustomerID.Value = DBNull.Value;
                }

                SqlParameter spTenderID = new SqlParameter();
                spTenderID.ParameterName = "@TenderID";
                spTenderID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTenderID.Value         = TenderID;

                SqlParameter spPostingType = new SqlParameter();
                spPostingType.ParameterName = "@PostingType";
                spPostingType.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spPostingType.Value         = PostingType;

                SqlParameter spCounter = new SqlParameter();
                spCounter.ParameterName = "@Counter";
                spCounter.SqlDbType     = System.Data.SqlDbType.Int;
                spCounter.Value         = Counter;

                SqlParameter spDocumentDate = new SqlParameter();
                spDocumentDate.ParameterName = "@DocumentDate";
                spDocumentDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDocumentDate.Value         = DocumentDate;

                SqlParameter spPostingDate = new SqlParameter();
                spPostingDate.ParameterName = "@PostingDate";
                spPostingDate.SqlDbType     = System.Data.SqlDbType.Date;
                spPostingDate.Value         = PostingDate;

                SqlParameter spAmount = new SqlParameter();
                spAmount.ParameterName = "@Amount";
                spAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spAmount.Value         = Amount;

                SqlParameter spChangeAmount = new SqlParameter();
                spChangeAmount.ParameterName = "@ChangeAmount";
                spChangeAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spChangeAmount.Value         = ChangeAmount;

                SqlParameter spPaidAmount = new SqlParameter();
                spPaidAmount.ParameterName = "@PaidAmount";
                spPaidAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spPaidAmount.Value         = PaidAmount;

                SqlParameter spTransCode = new SqlParameter();
                spTransCode.ParameterName = "@TransCode";
                spTransCode.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTransCode.Value         = TransCode;

                string TenderDtls = "INSERT INTO TBL_TENDER_DETAIL(DOCUMENTID,LOCATIONID,TERMINALID,COUNTER,COMPANYID,STORAGEID,DOCUMENTDATE,POSTINGTYPE,POSTINGDATE,CUSTOMERID,TENDERID,AMOUNT,PAIDAMOUNT,CHANGEAMOUNT,TRANSCODE) VALUES(@DOCUMENTID,@LOCATIONID,@TERMINALID,@COUNTER,@COMPANYID," +
                                    " @STORAGEID,@DOCUMENTDATE,@POSTINGTYPE,@POSTINGDATE,@CUSTOMERID,@TENDERID,@AMOUNT,@PAIDAMOUNT,@CHANGEAMOUNT,@TRANSCODE)";

                datacon.ConString = DataCon;
                datacon.CmdType   = CommandType.Text;
                datacon.CmdString = TenderDtls;

                datacon.InsertRecord(spDocumentID, spLocationID, spTerminalID, spCompanyID, spStorageID, spCustomerID, spTenderID,
                                     spPostingType, spCounter, spDocumentDate, spPostingDate, spAmount, spChangeAmount, spPaidAmount, spTransCode);
                UpdateReadTenderdtls();
            }
            catch (Exception ex)
            {
                string _Ex    = ex.Message;
                string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Tender_Detail'. Cannot insert duplicate key in object 'dbo.tbl_Tender_Detail'.\r\nThe statement has been terminated.";
                if (_Error.Equals(_Ex))
                {
                    UpdateReadTenderdtls();
                }
                else
                {
                    throw;
                }
            }
        }
예제 #3
0
        public void Detail()
        {
            try
            {
                SqlParameter spDoc = new SqlParameter();
                spDoc.ParameterName = "@DocumentID";
                spDoc.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spDoc.Value         = DocumentID;

                SqlParameter spLocationID = new SqlParameter();
                spLocationID.ParameterName = "@LocationID";
                spLocationID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationID.Value         = LocationID;

                SqlParameter spStorageID = new SqlParameter();
                spStorageID.ParameterName = "@StorageID";
                spStorageID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spStorageID.Value         = StorageID;

                SqlParameter spVendorId = new SqlParameter();
                spVendorId.ParameterName = "@VendorId";
                spVendorId.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spVendorId.Value         = VendorId;

                SqlParameter spCounter = new SqlParameter();
                spCounter.ParameterName = "@Counter";
                spCounter.SqlDbType     = System.Data.SqlDbType.Int;
                spCounter.Value         = Counter;

                SqlParameter spCompanyID = new SqlParameter();
                spCompanyID.ParameterName = "@CompanyID";
                spCompanyID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCompanyID.Value         = CompanyID;

                SqlParameter spDoumentDate = new SqlParameter();
                spDoumentDate.ParameterName = "@DocumentDate";
                spDoumentDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDoumentDate.Value         = DocumentDate;

                SqlParameter spPostingType = new SqlParameter();
                spPostingType.ParameterName = "@PostingType";
                spPostingType.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spPostingType.Value         = PostingType;

                SqlParameter spCategoryID = new SqlParameter();
                spCategoryID.ParameterName = "@CategoryID";
                spCategoryID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCategoryID.Value         = CategoryID;


                SqlParameter spMaterialID = new SqlParameter();
                spMaterialID.ParameterName = "@MaterialID";
                spMaterialID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spMaterialID.Value         = MaterialID;

                SqlParameter spUOM = new SqlParameter();
                spUOM.ParameterName = "@UOM";
                spUOM.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spUOM.Value         = UOM;

                SqlParameter spTranQty = new SqlParameter();
                spTranQty.ParameterName = "@TranQty";
                spTranQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spTranQty.Value         = TranQty;

                SqlParameter spBaseQty = new SqlParameter();
                spBaseQty.ParameterName = "@EntryBaseQty";
                spBaseQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spBaseQty.Value         = BaseQty;

                SqlParameter spCreditQty = new SqlParameter();
                spCreditQty.ParameterName = "@CreditQty";
                spCreditQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCreditQty.Value         = CreditQty;

                SqlParameter spCost = new SqlParameter();
                spCost.ParameterName = "@Cost";
                spCost.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCost.Value         = Cost;

                SqlParameter spDiscountRate = new SqlParameter();
                spDiscountRate.ParameterName = "@DiscountRate";
                spDiscountRate.SqlDbType     = System.Data.SqlDbType.Decimal;
                spDiscountRate.Value         = DiscountRate;

                SqlParameter spAmount = new SqlParameter();
                spAmount.ParameterName = "@Amount";
                spAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spAmount.Value         = Amount;

                SqlParameter spCreditAmount = new SqlParameter();
                spCreditAmount.ParameterName = "@CreditAmount";
                spCreditAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCreditAmount.Value         = CreditAmount;

                SqlParameter spUserID = new SqlParameter();
                spUserID.ParameterName = "@UserID";
                spUserID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spUserID.Value         = UserID;

                SqlParameter spPostKey = new SqlParameter();
                spPostKey.ParameterName = "@PostKey";
                spPostKey.SqlDbType     = System.Data.SqlDbType.Int;
                spPostKey.Value         = PostKey;

                SqlParameter spAddDate = new SqlParameter();
                spAddDate.ParameterName = "@AddDate";
                spAddDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spAddDate.Value         = AddDate;

                SqlParameter spUpdDate = new SqlParameter();
                spUpdDate.ParameterName = "@UpdDate";
                spUpdDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spUpdDate.Value         = UpdDate;

                SqlParameter spPostingDate = new SqlParameter();
                spPostingDate.ParameterName = "@PostingDate";
                spPostingDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spPostingDate.Value         = PostingDate;

                SqlParameter spconvertFactor = new SqlParameter();
                spconvertFactor.ParameterName = "@ConvertFactor";
                spconvertFactor.SqlDbType     = System.Data.SqlDbType.Decimal;
                spconvertFactor.Value         = ConvertFactor;



                string TransferDtls = "Proc_PhyInventory_Detail";//Proc_TransferDisplay_Ent_In_Out

                datacon1.ConString = ConfigurationManager.ConnectionStrings["ConnectionStringSvr"].ConnectionString;
                datacon1.CmdType   = CommandType.StoredProcedure;
                datacon1.CmdString = TransferDtls;

                datacon1.InsertRecord(spDoc, spCompanyID, spLocationID, spStorageID, spDoumentDate, spPostingDate,
                                      spMaterialID, spBaseQty, spAddDate, spUpdDate, spCategoryID, spUserID, spconvertFactor);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #4
0
        public DataTable InsertEOD()
        {
            DataTable dtEOD = null;

            try
            {
                SqlParameter spLocationID = new SqlParameter();
                spLocationID.ParameterName = "@LocationID";
                spLocationID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationID.Value         = LocationID;

                SqlParameter spTermininalID = new SqlParameter();
                spTermininalID.ParameterName = "@TerminialID";
                spTermininalID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTermininalID.Value         = TerminalID;

                SqlParameter spEODID = new SqlParameter();
                spEODID.ParameterName = "@EODID";
                spEODID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spEODID.Value         = EODID;

                SqlParameter spDocDate = new SqlParameter();
                spDocDate.ParameterName = "@DocDate";
                spDocDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDocDate.Value         = DocDate;

                SqlParameter spLoan = new SqlParameter();
                spLoan.ParameterName = "@Loan";
                spLoan.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLoan.Value         = Loan;

                SqlParameter spSystemCash = new SqlParameter();
                spSystemCash.ParameterName = "@SystemCash";
                spSystemCash.SqlDbType     = System.Data.SqlDbType.Decimal;
                spSystemCash.Value         = SystemCash;

                SqlParameter spActualCash = new SqlParameter();
                spActualCash.ParameterName = "@ActualCash";
                spActualCash.SqlDbType     = System.Data.SqlDbType.Decimal;
                spActualCash.Value         = ActualCash;

                SqlParameter spCash1 = new SqlParameter();
                spCash1.ParameterName = "@1";
                spCash1.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash1.Value         = Cash1;

                SqlParameter spCash5 = new SqlParameter();
                spCash5.ParameterName = "@5";
                spCash5.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash5.Value         = Cash5;

                SqlParameter spCash10 = new SqlParameter();
                spCash10.ParameterName = "@10";
                spCash10.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash10.Value         = Cash10;

                SqlParameter spCash20 = new SqlParameter();
                spCash20.ParameterName = "@20";
                spCash20.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash20.Value         = Cash20;

                SqlParameter spCash50 = new SqlParameter();
                spCash50.ParameterName = "@50";
                spCash50.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash50.Value         = Cash50;

                SqlParameter spCash100 = new SqlParameter();
                spCash100.ParameterName = "@100";
                spCash100.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash100.Value         = Cash100;

                SqlParameter spCash200 = new SqlParameter();
                spCash200.ParameterName = "@200";
                spCash200.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash200.Value         = Cash200;

                SqlParameter spCash500 = new SqlParameter();
                spCash500.ParameterName = "@500";
                spCash500.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCash500.Value         = Cash500;

                SqlParameter spCashDiff = new SqlParameter();
                spCashDiff.ParameterName = "@CashDiff";
                spCashDiff.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCashDiff.Value         = CashDiff;

                SqlParameter spCashCount = new SqlParameter();
                spCashCount.ParameterName = "@CashCount";
                spCashCount.SqlDbType     = System.Data.SqlDbType.Int;
                spCashCount.Value         = CashCount;

                SqlParameter spCreditAmt = new SqlParameter();
                spCreditAmt.ParameterName = "@CreditAmt";
                spCreditAmt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCreditAmt.Value         = CreditAmt;


                SqlParameter spDebitAmt = new SqlParameter();
                spDebitAmt.ParameterName = "@DebitAmt";
                spDebitAmt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spDebitAmt.Value         = DebitAmt;

                SqlParameter spDebitCnt = new SqlParameter();
                spDebitCnt.ParameterName = "@DebitCnt";
                spDebitCnt.SqlDbType     = System.Data.SqlDbType.Int;
                spDebitCnt.Value         = DebitCnt;

                SqlParameter spReturnAmt = new SqlParameter();
                spReturnAmt.ParameterName = "@ReturnAmt";
                spReturnAmt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spReturnAmt.Value         = ReturnAmt;

                SqlParameter spReturnCnt = new SqlParameter();
                spReturnCnt.ParameterName = "@ReturnCnt";
                spReturnCnt.SqlDbType     = System.Data.SqlDbType.Int;
                spReturnCnt.Value         = ReturnCnt;

                SqlParameter spDeleteAmt = new SqlParameter();
                spDeleteAmt.ParameterName = "@DeleteAmt";
                spDeleteAmt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spDeleteAmt.Value         = DeleteAmt;

                SqlParameter spDeleteCnt = new SqlParameter();
                spDeleteCnt.ParameterName = "@DeleteCnt";
                spDeleteCnt.SqlDbType     = System.Data.SqlDbType.Int;
                spDeleteCnt.Value         = DeleteCnt;

                SqlParameter spOnAccAmt = new SqlParameter();
                spOnAccAmt.ParameterName = "@OnAccAmt";
                spOnAccAmt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spOnAccAmt.Value         = OnAccAmt;

                SqlParameter spOnAccCnt = new SqlParameter();
                spOnAccCnt.ParameterName = "@OnAccCnt";
                spOnAccCnt.SqlDbType     = System.Data.SqlDbType.Int;
                spOnAccCnt.Value         = OnAccCnt;

                SqlParameter spCust1Amt = new SqlParameter();
                spCust1Amt.ParameterName = "@Cust1Amt";
                spCust1Amt.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCust1Amt.Value         = Cust1Amt;

                SqlParameter spCust1Cnt = new SqlParameter();
                spCust1Cnt.ParameterName = "@";
                spCust1Cnt.SqlDbType     = System.Data.SqlDbType.Int;
                spCust1Cnt.Value         = Cust1Cnt;

                SqlParameter spCust2Amt = new SqlParameter();
                spCust2Amt.ParameterName = "@";
                spCust2Amt.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCust2Amt.Value         = Cust2Amt;

                SqlParameter spCust2Cnt = new SqlParameter();
                spCust2Cnt.ParameterName = "@";
                spCust2Cnt.SqlDbType     = System.Data.SqlDbType.Int;
                spCust2Cnt.Value         = Cust2Cnt;

                SqlParameter spCreditCnt = new SqlParameter();
                spCreditCnt.ParameterName = "@CreditCnt";
                spCreditCnt.SqlDbType     = System.Data.SqlDbType.Int;
                spCreditCnt.Value         = CreditCnt;


                string EOD = "Proc_SyncInsertEod";


                datacon1.ConString = DataCon;
                datacon1.CmdType   = CommandType.StoredProcedure;
                datacon1.CmdString = EOD;

                datacon1.InsertRecord(spLocationID, spTermininalID, spEODID, spDocDate, spLoan, spSystemCash, spActualCash, spCash1, spCash5,
                                      spCash10, spCash20, spCash50, spCash100, spCash200, spCash500, spCashDiff, spCashCount, spCreditAmt, spDebitAmt,
                                      spDebitCnt, spReturnAmt, spReturnCnt, spDeleteAmt, spDeleteCnt, spOnAccAmt, spOnAccCnt, spCreditCnt, spCust1Amt);

                UpdateReadEod();
            }
            catch (Exception ex)
            {
                string _Ex    = ex.Message;
                string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_EOD'. Cannot insert duplicate key in object 'dbo.tbl_EOD'.\r\nThe statement has been terminated.";
                if (_Error.Equals(_Ex))
                {
                    UpdateReadEod();
                }
                else
                {
                    throw;
                }
            }
            return(dtEOD);
        }
예제 #5
0
        public void InsertInvoiceDtls()
        {
            try
            {
                SqlParameter spDoc = new SqlParameter();
                spDoc.ParameterName = "@DocumentID";
                spDoc.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spDoc.Value         = DocumentID;

                SqlParameter spLocationID = new SqlParameter();
                spLocationID.ParameterName = "@LocationID";
                spLocationID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationID.Value         = LocationID;

                SqlParameter spStorageID = new SqlParameter();
                spStorageID.ParameterName = "@StorageID";
                spStorageID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spStorageID.Value         = StorageID;

                SqlParameter spTerminalID = new SqlParameter();
                spTerminalID.ParameterName = "@TerminalID";
                spTerminalID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTerminalID.Value         = TerminalID;

                SqlParameter spCounter = new SqlParameter();
                spCounter.ParameterName = "@Counter";
                spCounter.SqlDbType     = System.Data.SqlDbType.Int;
                spCounter.Value         = Counter;

                SqlParameter spSalesOrder = new SqlParameter();
                spSalesOrder.ParameterName = "@SalesOrder";
                spSalesOrder.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spSalesOrder.Value         = SalesOrder;

                SqlParameter spCompanyID = new SqlParameter();
                spCompanyID.ParameterName = "@CompanyID";
                spCompanyID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCompanyID.Value         = CompanyID;

                SqlParameter spDoumentDate = new SqlParameter();
                spDoumentDate.ParameterName = "@DocumentDate";
                spDoumentDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDoumentDate.Value         = DocumentDate;

                SqlParameter spPostingType = new SqlParameter();
                spPostingType.ParameterName = "@PostingType";
                spPostingType.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spPostingType.Value         = PostingType;

                SqlParameter spCustomerID = new SqlParameter();
                spCustomerID.ParameterName = "@CustomerID";
                spCustomerID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                if (!CustomerID.Equals(string.Empty))
                {
                    spCustomerID.Value = CustomerID;
                }
                else
                {
                    spCustomerID.Value = DBNull.Value;
                }

                SqlParameter spCategoryID = new SqlParameter();
                spCategoryID.ParameterName = "@CategoryID";
                spCategoryID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCategoryID.Value         = CategoryID;


                SqlParameter spMaterialID = new SqlParameter();
                spMaterialID.ParameterName = "@MaterialID";
                spMaterialID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spMaterialID.Value         = MaterialID;

                SqlParameter spUOM = new SqlParameter();
                spUOM.ParameterName = "@UOM";
                spUOM.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spUOM.Value         = UOM;

                SqlParameter spTranQty = new SqlParameter();
                spTranQty.ParameterName = "@TranQty";
                spTranQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spTranQty.Value         = TranQty;

                SqlParameter spBaseQty = new SqlParameter();
                spBaseQty.ParameterName = "@BaseQty";
                spBaseQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spBaseQty.Value         = BaseQty;

                SqlParameter spCreditQty = new SqlParameter();
                spCreditQty.ParameterName = "@CreditQty";
                spCreditQty.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCreditQty.Value         = CreditQty;

                SqlParameter spCost = new SqlParameter();
                spCost.ParameterName = "@Cost";
                spCost.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCost.Value         = Cost;

                SqlParameter spPrice = new SqlParameter();
                spPrice.ParameterName = "@Price";
                spPrice.SqlDbType     = System.Data.SqlDbType.Decimal;
                spPrice.Value         = Price;

                SqlParameter spDiscountRate = new SqlParameter();
                spDiscountRate.ParameterName = "@DiscountRate";
                spDiscountRate.SqlDbType     = System.Data.SqlDbType.Decimal;
                spDiscountRate.Value         = DiscountRate;

                SqlParameter spAmount = new SqlParameter();
                spAmount.ParameterName = "@Amount";
                spAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spAmount.Value         = Amount;

                SqlParameter spCreditAmount = new SqlParameter();
                spCreditAmount.ParameterName = "@CreditAmount";
                spCreditAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCreditAmount.Value         = CreditAmount;

                SqlParameter spUserID = new SqlParameter();
                spUserID.ParameterName = "@UserID";
                spUserID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spUserID.Value         = UserID;

                SqlParameter spPostKey = new SqlParameter();
                spPostKey.ParameterName = "@PostKey";
                spPostKey.SqlDbType     = System.Data.SqlDbType.Int;
                spPostKey.Value         = PostKey;

                SqlParameter spAddDate = new SqlParameter();
                spAddDate.ParameterName = "@AddDate";
                spAddDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spAddDate.Value         = AddDate;

                SqlParameter spUpdDate = new SqlParameter();
                spUpdDate.ParameterName = "@UpdDate";
                spUpdDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spUpdDate.Value         = UpdDate;

                SqlParameter spPostingDate = new SqlParameter();
                spPostingDate.ParameterName = "@PostingDate";
                spPostingDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spPostingDate.Value         = DocumentDate;

                SqlParameter spOrderNo = new SqlParameter();
                spOrderNo.ParameterName = "@OrderNo";
                spOrderNo.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spOrderNo.Value         = OrderNo;

                SqlParameter spSalesComm = new SqlParameter();
                spSalesComm.ParameterName = "@SalesComm";
                spSalesComm.SqlDbType     = System.Data.SqlDbType.Decimal;
                spSalesComm.Value         = Sales_Comm;

                SqlParameter spProducComm = new SqlParameter();
                spProducComm.ParameterName = "@ProducComm";
                spProducComm.SqlDbType     = System.Data.SqlDbType.Decimal;
                spProducComm.Value         = Produc_Comm;

                SqlParameter spTax = new SqlParameter();
                spTax.ParameterName = "@Tax";
                spTax.SqlDbType     = System.Data.SqlDbType.Decimal;
                spTax.Value         = TaxAmount;

                SqlParameter spCostAmount = new SqlParameter();
                spCostAmount.ParameterName = "@CostAmount";
                spCostAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spCostAmount.Value         = CostAmount;

                SqlParameter spOrderUserName = new SqlParameter();
                spOrderUserName.ParameterName = "@OrderUserName";
                spOrderUserName.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spOrderUserName.Value         = OrderUsername;

                SqlParameter spOrderTransQty = new SqlParameter();
                spOrderTransQty.ParameterName = "@OrderTransQty";
                spOrderTransQty.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spOrderTransQty.Value         = OrderTransQty;

                SqlParameter spOrderBaseQty = new SqlParameter();
                spOrderBaseQty.ParameterName = "@OrderBaseQty";
                spOrderBaseQty.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spOrderBaseQty.Value         = OrderBaseQty;

                string InvoiceDtls = "INSERT INTO TBL_SALES_DETAIL(DOCUMENTID,COMPANYID,LOCATIONID,STORAGEID,TERMINALID,DOCUMENTDATE,POSTINGTYPE,CUSTOMERID,COUNTER,CATEGORYID,MATERIALID,POSTINGDATE,UOM," +
                                     " TRANQTY,BASEQTY,CREDITQTY,COST,PRICE,DISCOUNTRATE,AMOUNT,CREDITAMOUNT,USERID,POSTKEY,ADDDATE,UPDDATE,RtnQty,OrderNo,Sales_CommAmount,Produc_CommAmount,TaxAmount,CostAmount,OrderUserName,OrderTransQty,OrderBaseQty)" +
                                     " VALUES(@DOCUMENTID,@COMPANYID,@LOCATIONID,@STORAGEID,@TERMINALID,@DOCUMENTDATE," +
                                     " @POSTINGTYPE,@CUSTOMERID,@COUNTER,@CATEGORYID,@MATERIALID,@POSTINGDATE,@UOM," +
                                     " @TRANQTY,@BASEQTY,@CREDITQTY,@COST,@PRICE,@DISCOUNTRATE,@AMOUNT,@CREDITAMOUNT,@USERID,@POSTKEY,@ADDDATE," +
                                     " @UPDDATE,0,@OrderNo,@SalesComm,@ProducComm,@Tax,@CostAmount,@OrderUserName,@OrderTransQty,@OrderBaseQty)";

                dcon.ConString = Datacon;
                dcon.CmdType   = CommandType.Text;
                dcon.CmdString = InvoiceDtls;

                dcon.InsertRecord(spDoc, spCompanyID, spLocationID, spStorageID, spTerminalID, spDoumentDate, spPostingType, spCustomerID, spCounter, spCategoryID, spMaterialID, spPostingDate,
                                  spUOM, spTranQty, spBaseQty, spCreditQty, spCost, spPrice, spDiscountRate, spAmount, spCreditAmount, spUserID, spPostKey, spAddDate, spUpdDate, spOrderNo, spSalesComm, spProducComm, spTax, spCostAmount,
                                  spOrderUserName, spOrderTransQty, spOrderBaseQty);
                UpdateReadSalesdtls();
            }
            catch (Exception ex)
            {
                string _Ex    = ex.Message;
                string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Sales_Detail'. Cannot insert duplicate key in object 'dbo.tbl_Sales_Detail'.\r\nThe statement has been terminated.";
                if (_Error.Equals(_Ex))
                {
                    UpdateReadSalesdtls();
                }
                else
                {
                    throw;
                }
            }
        }
예제 #6
0
        public void InsertSalesCategory()
        {
            try
            {
                SqlParameter spCompanyId = new SqlParameter();
                spCompanyId.ParameterName = "@CompanyId";
                spCompanyId.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCompanyId.Value         = CompanyId;

                SqlParameter spLocationId = new SqlParameter();
                spLocationId.ParameterName = "@LocationId";
                spLocationId.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationId.Value         = LocationId;

                SqlParameter spTerminalId = new SqlParameter();
                spTerminalId.ParameterName = "@TerminalId";
                spTerminalId.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTerminalId.Value         = TerminalId;


                SqlParameter spDoc = new SqlParameter();
                spDoc.ParameterName = "@DocumentId";
                spDoc.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spDoc.Value         = DocumentId;

                SqlParameter spCategoryName = new SqlParameter();
                spCategoryName.ParameterName = "@CategoryName";
                spCategoryName.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spCategoryName.Value         = CategoryName;

                SqlParameter spUserName = new SqlParameter();
                spUserName.ParameterName = "@UserName";
                spUserName.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spUserName.Value         = UserName;

                SqlParameter spAmount = new SqlParameter();
                spAmount.ParameterName = "@Amount";
                spAmount.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spAmount.Value         = Amount;

                SqlParameter spDocDate = new SqlParameter();
                spDocDate.ParameterName = "@Date";
                spDocDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDocDate.Value         = Date;

                string s = "Proc_InsertSalesCategory";

                DbSvr.ConString = ConfigurationManager.ConnectionStrings["ConnectionStringSvr"].ToString();
                DbSvr.CmdType   = CommandType.StoredProcedure;
                DbSvr.CmdString = s;

                DbSvr.InsertRecord(spDoc, spCategoryName, spUserName, spAmount, spDocDate, spCompanyId, spLocationId, spTerminalId);
                UpdateSalesCategory();
            }
            catch (Exception ex)
            {
                string _Ex    = ex.Message;
                string _Error = "";
                if (_Error.Equals(_Ex))
                {
                    UpdateSalesCategory();
                }
                else
                {
                    throw;
                }
            }
        }
예제 #7
0
        public DataTable InsertEODdtls()
        {
            DataTable dtEODdtls = null;

            try
            {
                SqlParameter spLocationID = new SqlParameter();
                spLocationID.ParameterName = "@LocationID";
                spLocationID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spLocationID.Value         = LocationID;

                SqlParameter spTermininalID = new SqlParameter();
                spTermininalID.ParameterName = "@TerminalID";
                spTermininalID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTermininalID.Value         = TerminalID;

                SqlParameter spEODID = new SqlParameter();
                spEODID.ParameterName = "@EODID";
                spEODID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spEODID.Value         = EODID;

                SqlParameter spDocDate = new SqlParameter();
                spDocDate.ParameterName = "@DocDate";
                spDocDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spDocDate.Value         = DocDate;

                SqlParameter spTransactionDate = new SqlParameter();
                spTransactionDate.ParameterName = "@TransactionDate";
                spTransactionDate.SqlDbType     = System.Data.SqlDbType.DateTime;
                spTransactionDate.Value         = TransactionDate;

                SqlParameter spTransactionType = new SqlParameter();
                spTransactionType.ParameterName = "@TransactionType";
                spTransactionType.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTransactionType.Value         = TransactionType;

                SqlParameter spTransactionID = new SqlParameter();
                spTransactionID.ParameterName = "@TransactionID";
                spTransactionID.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spTransactionID.Value         = TransactionID;

                SqlParameter spCount = new SqlParameter();
                spCount.ParameterName = "@Count";
                spCount.SqlDbType     = System.Data.SqlDbType.BigInt;
                spCount.Value         = Count;

                SqlParameter spPayType = new SqlParameter();
                spPayType.ParameterName = "@PayType";
                spPayType.SqlDbType     = System.Data.SqlDbType.NVarChar;
                spPayType.Value         = PayType;

                SqlParameter spAmount = new SqlParameter();
                spAmount.ParameterName = "@Amount";
                spAmount.SqlDbType     = System.Data.SqlDbType.Decimal;
                spAmount.Value         = Amount;


                string EODdtls = "Proc_SyncInsertEoddtls";

                datacon1.ConString = Datacon;
                datacon1.CmdType   = CommandType.StoredProcedure;
                datacon1.CmdString = EODdtls;

                datacon1.InsertRecord(spLocationID, spTermininalID, spEODID, spDocDate, spTransactionDate,
                                      spTransactionType, spTransactionID, spCount, spPayType, spAmount);

                UpdateReadEoddtls();
            }
            catch (Exception ex)
            {
                string _Ex    = ex.Message;
                string _Error = "Violation of PRIMARY KEY constraint 'tbl_eoddtls'. Cannot insert duplicate key in object 'dbo.tbl_eoddtls'.\r\nThe statement has been terminated.";
                if (_Error.Equals(_Ex))
                {
                    UpdateReadEoddtls();
                }
                else
                {
                    throw;
                }
            }
            return(dtEODdtls);
        }