예제 #1
0
 private void UpdateFooter(SODetails clsSODetails)
 {
     lblSODiscount.Text = clsSODetails.Discount.ToString("#,##0.#0");
     lblSOVatableAmount.Text = clsSODetails.VatableAmount.ToString("#,##0.#0");
     txtSOFreight.Text = clsSODetails.Freight.ToString("#,##0.#0");
     txtSODeposit.Text = clsSODetails.Deposit.ToString("#,##0.#0");
     lblSOSubTotal.Text = Convert.ToDecimal(clsSODetails.SubTotal - clsSODetails.VAT).ToString("#,##0.#0");
     lblSOVAT.Text = clsSODetails.VAT.ToString("#,##0.#0");
     lblSOTotal.Text = clsSODetails.SubTotal.ToString("#,##0.#0");
 }
예제 #2
0
        private void SaveRecord()
        {
            SODetails clsDetails = new SODetails();

            clsDetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsDetails.SONo = lblSONo.Text;
            clsDetails.SODate = Convert.ToDateTime(lblSODate.Text);
            clsDetails.CustomerID = Convert.ToInt64(cboCustomer.SelectedItem.Value);
            clsDetails.CustomerCode = cboCustomer.SelectedItem.Text;
            clsDetails.CustomerContact = txtCustomerContact.Text;
            clsDetails.CustomerAddress = txtCustomerAddress.Text;
            clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text;
            switch (lblModeOfterms.Text)
            {
                case "Days":
                    clsDetails.CustomerModeOfTerms = 0;
                    break;
                case "Months":
                    clsDetails.CustomerModeOfTerms = 1;
                    break;
                case "Years":
                    clsDetails.CustomerModeOfTerms = 2;
                    break;
            }
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.SellerName = Session["Name"].ToString();
            clsDetails.Status = SOStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            SO clsSO = new SO();
            clsSO.Update(clsDetails);
            clsSO.CommitAndDispose();
        }
예제 #3
0
        private void UpdateSODiscount()
        {
            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SO clsSO = new SO();
            clsSO.UpdateDiscount(clsSODetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType);
            clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));
            clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));
            clsSO.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
예제 #4
0
        private void UpdateDeposit()
        {
            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsSODetails.Deposit = Convert.ToDecimal(txtSODeposit.Text);

            SO clsSO = new SO();
            clsSO.UpdateDeposit(clsSODetails.SOID, clsSODetails.Deposit);
            clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));
            clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));
            clsSO.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
예제 #5
0
        private void SaveRecord()
        {
            SOItemDetails clsDetails = new SOItemDetails();

            Products clsProducts = new Products();
            ProductDetails clsProductDetails = clsProducts.Details1(Constants.BRANCH_ID_MAIN, Convert.ToInt64(cboProductCode.SelectedItem.Value));

            Terminal clsTerminal = new Terminal(clsProducts.Connection, clsProducts.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            clsProducts.CommitAndDispose();

            clsDetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
            clsDetails.ProductCode = clsProductDetails.ProductCode;
            clsDetails.BarCode = clsProductDetails.BarCode;
            clsDetails.Description = clsProductDetails.ProductDesc;
            clsDetails.ProductUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
            clsDetails.ProductUnitCode = cboProductUnit.SelectedItem.Text;
            clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
            clsDetails.UnitCost = Convert.ToDecimal(txtPrice.Text);
            clsDetails.Discount = getItemTotalDiscount();
            clsDetails.DiscountApplied = Convert.ToDecimal(txtDiscount.Text);
            if (clsDetails.DiscountApplied == 0)
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }
            else
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }

            clsDetails.IsVatable = chkIsTaxable.Checked;
            clsDetails.Amount = ComputeItemAmount();

            if (clsDetails.IsVatable)
            {
                clsDetails.VatableAmount = clsDetails.Amount;
                clsDetails.EVatableAmount = clsDetails.Amount;
                clsDetails.LocalTax = clsDetails.Amount;

                if (clsTerminalDetails.IsVATInclusive == false)
                {
                    if (clsDetails.VatableAmount < clsDetails.Discount) clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount < clsDetails.Discount) clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax < clsDetails.Discount) clsDetails.LocalTax = 0;
                }
                else
                {
                    if (clsDetails.VatableAmount >= clsDetails.Discount) clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount >= clsDetails.Discount) clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax >= clsDetails.Discount) clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100)); else clsDetails.LocalTax = 0;
                }

                clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
                clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
                clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);

                //if (!clsTerminalDetails.IsVATInclusive) clsDetails.Amount += (clsDetails.VAT + clsDetails.LocalTax);
                //if (!clsTerminalDetails.EnableEVAT) clsDetails.Amount += clsDetails.EVAT;
            }
            else
            {
                clsDetails.VAT = 0;
                clsDetails.VatableAmount = 0;
                clsDetails.EVAT = 0;
                clsDetails.EVatableAmount = 0;
                clsDetails.LocalTax = 0;
            }

            clsDetails.isVATInclusive = clsTerminalDetails.IsVATInclusive;
            clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
            if (clsDetails.VariationMatrixID != 0)
                clsDetails.MatrixDescription = cboVariation.SelectedItem.Text;
            clsDetails.ProductGroup = clsProductDetails.ProductGroupCode;
            clsDetails.ProductSubGroup = clsProductDetails.ProductSubGroupCode;
            clsDetails.Remarks = txtRemarks.Text;

            // Added Jul 1, 2010 4:20PM : for suggested selling information
            clsDetails.SellingPrice = decimal.Parse(txtSellingPrice.Text);
            clsDetails.SellingVAT = decimal.Parse(txtVAT.Text);
            clsDetails.SellingEVAT = decimal.Parse(txtEVAT.Text);
            clsDetails.SellingLocalTax = decimal.Parse(txtLocalTax.Text);

            SOItem clsSOItem = new SOItem();
            if (lblSOItemID.Text != "0")
            {
                clsDetails.SOItemID = Convert.ToInt64(lblSOItemID.Text);
                clsSOItem.Update(clsDetails);
            }
            else
                clsSOItem.Insert(clsDetails);

            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = clsDetails.SOID;
            clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SO clsSO = new SO(clsSOItem.Connection, clsSOItem.Transaction);
            clsSO.UpdateDiscount(clsDetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType);

            clsSODetails = clsSO.Details(clsDetails.SOID);
            clsSOItem.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
예제 #6
0
파일: SO.cs 프로젝트: marioricci/erp-luma
		public long Insert(SODetails Details)
		{
			try
			{
                ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction);
				ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails();

				string SQL = "INSERT INTO tblSO (" +
								"SONo, " +
								"SODate, " +
								"CustomerID, " +
								"CustomerCode, " +
								"CustomerContact, " +
								"CustomerAddress, " +
								"CustomerTelephoneNo, " +
								"CustomerModeOfTerms, " +
								"CustomerTerms, " +
								"RequiredDeliveryDate, " +
								"BranchID, " +
								"SellerID, " +
								"SellerName, " +
								"Status, " +
								"Remarks, " +
								"ChartOfAccountIDARTracking, " +
								"ChartOfAccountIDARBills, " +
								"ChartOfAccountIDARFreight, " +
								"ChartOfAccountIDARVDeposit, " +
								"ChartOfAccountIDARContra, " +
								"ChartOfAccountIDARLatePayment" +
							") VALUES (" +
								"@SONo, " +
								"@SODate, " +
								"@CustomerID, " +
								"@CustomerCode, " +
								"@CustomerContact, " +
								"@CustomerAddress, " +
								"@CustomerTelephoneNo, " +
								"@CustomerModeOfTerms, " +
								"@CustomerTerms, " +
								"@RequiredDeliveryDate, " +
								"@BranchID, " +
								"@SellerID, " +
								"@SellerName, " +
								"@Status, " +
								"@Remarks, " +
								"@ChartOfAccountIDARTracking, " +
								"@ChartOfAccountIDARBills, " +
								"@ChartOfAccountIDARFreight, " +
								"@ChartOfAccountIDARVDeposit, " +
								"@ChartOfAccountIDARContra, " +
								"@ChartOfAccountIDARLatePayment" +
							");";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

				MySqlParameter prmSONo = new MySqlParameter("@SONo",MySqlDbType.String);
				prmSONo.Value = Details.SONo;
				cmd.Parameters.Add(prmSONo);

				MySqlParameter prmSODate = new MySqlParameter("@SODate",MySqlDbType.DateTime);
				prmSODate.Value = Details.SODate.ToString("yyyy-MM-dd HH:mm:ss");
				cmd.Parameters.Add(prmSODate);

				MySqlParameter prmCustomerID = new MySqlParameter("@CustomerID",MySqlDbType.Int64);
				prmCustomerID.Value = Details.CustomerID;
				cmd.Parameters.Add(prmCustomerID);

				MySqlParameter prmCustomerCode = new MySqlParameter("@CustomerCode",MySqlDbType.String);
				prmCustomerCode.Value = Details.CustomerCode;
				cmd.Parameters.Add(prmCustomerCode);

				MySqlParameter prmCustomerContact = new MySqlParameter("@CustomerContact",MySqlDbType.String);
				prmCustomerContact.Value = Details.CustomerContact;
				cmd.Parameters.Add(prmCustomerContact);

				MySqlParameter prmCustomerAddress = new MySqlParameter("@CustomerAddress",MySqlDbType.String);
				prmCustomerAddress.Value = Details.CustomerAddress;
				cmd.Parameters.Add(prmCustomerAddress);

				MySqlParameter prmCustomerTelephoneNo = new MySqlParameter("@CustomerTelephoneNo",MySqlDbType.String);
				prmCustomerTelephoneNo.Value = Details.CustomerTelephoneNo;
				cmd.Parameters.Add(prmCustomerTelephoneNo);

				MySqlParameter prmCustomerModeOfTerms = new MySqlParameter("@CustomerModeOfTerms",MySqlDbType.Int16);
				prmCustomerModeOfTerms.Value = Details.CustomerModeOfTerms;
				cmd.Parameters.Add(prmCustomerModeOfTerms);

				MySqlParameter prmCustomerTerms = new MySqlParameter("@CustomerTerms",MySqlDbType.Int16);
				prmCustomerTerms.Value = Details.CustomerTerms;
				cmd.Parameters.Add(prmCustomerTerms);

				MySqlParameter prmRequiredDeliveryDate = new MySqlParameter("@RequiredDeliveryDate",MySqlDbType.DateTime);
				prmRequiredDeliveryDate.Value = Details.RequiredDeliveryDate.ToString("yyyy-MM-dd HH:mm:ss");
				cmd.Parameters.Add(prmRequiredDeliveryDate);

				MySqlParameter prmBranchID = new MySqlParameter("@BranchID",MySqlDbType.Int16);
				prmBranchID.Value = Details.BranchID;
				cmd.Parameters.Add(prmBranchID);

				MySqlParameter prmSellerID = new MySqlParameter("@SellerID",MySqlDbType.Int64);
				prmSellerID.Value = Details.SellerID;
				cmd.Parameters.Add(prmSellerID);

				MySqlParameter prmSellerName = new MySqlParameter("@SellerName",MySqlDbType.String);
				prmSellerName.Value = Details.SellerName;
				cmd.Parameters.Add(prmSellerName);

				MySqlParameter prmStatus = new MySqlParameter("@Status",MySqlDbType.Int16);
				prmStatus.Value = Details.Status.ToString("d");
				cmd.Parameters.Add(prmStatus);

				MySqlParameter prmRemarks = new MySqlParameter("@Remarks",MySqlDbType.String);
				prmRemarks.Value = Details.Remarks;
				cmd.Parameters.Add(prmRemarks);

				MySqlParameter prmChartOfAccountIDARTracking = new MySqlParameter("@ChartOfAccountIDARTracking",MySqlDbType.Int32);
				prmChartOfAccountIDARTracking.Value = clsARLinkConfigDetails.ChartOfAccountIDARTracking;
				cmd.Parameters.Add(prmChartOfAccountIDARTracking);

				MySqlParameter prmChartOfAccountIDARBills = new MySqlParameter("@ChartOfAccountIDARBills",MySqlDbType.Int32);
				prmChartOfAccountIDARBills.Value = clsARLinkConfigDetails.ChartOfAccountIDARBills;
				cmd.Parameters.Add(prmChartOfAccountIDARBills);

				MySqlParameter prmChartOfAccountIDARFreight = new MySqlParameter("@ChartOfAccountIDARFreight",MySqlDbType.Int32);
				prmChartOfAccountIDARFreight.Value = clsARLinkConfigDetails.ChartOfAccountIDARFreight;
				cmd.Parameters.Add(prmChartOfAccountIDARFreight);

				MySqlParameter prmChartOfAccountIDARVDeposit = new MySqlParameter("@ChartOfAccountIDARVDeposit",MySqlDbType.Int32);
				prmChartOfAccountIDARVDeposit.Value = clsARLinkConfigDetails.ChartOfAccountIDARVDeposit;
				cmd.Parameters.Add(prmChartOfAccountIDARVDeposit);

				MySqlParameter prmChartOfAccountIDARContra = new MySqlParameter("@ChartOfAccountIDARContra",MySqlDbType.Int32);
				prmChartOfAccountIDARContra.Value = clsARLinkConfigDetails.ChartOfAccountIDARContra;
				cmd.Parameters.Add(prmChartOfAccountIDARContra);

				MySqlParameter prmChartOfAccountIDARLatePayment = new MySqlParameter("@ChartOfAccountIDARLatePayment",MySqlDbType.Int32);
				prmChartOfAccountIDARLatePayment.Value = clsARLinkConfigDetails.ChartOfAccountIDARLatePayment;
				cmd.Parameters.Add(prmChartOfAccountIDARLatePayment);

                base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                cmd.CommandText = SQL;

                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                Int64 iID = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

                return iID;
			}

			catch (Exception ex)
			{
                throw base.ThrowException(ex);
			}
		}
예제 #7
0
파일: SO.cs 프로젝트: marioricci/erp-luma
		public void Update(SODetails Details)
		{
			try
			{
                ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction);
				ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails();

				string SQL = "UPDATE tblSO SET " +
								"SONo					=	@SONo, " +
								"SODate					=	@SODate, " +
								"CustomerID				=	@CustomerID, " +
								"CustomerCode			=	@CustomerCode, " +
								"CustomerContact		=	@CustomerContact, " +
								"CustomerAddress		=	@CustomerAddress, " +
								"CustomerTelephoneNo	=	@CustomerTelephoneNo, " +
								"CustomerModeOfTerms	=	@CustomerModeOfTerms, " +
								"CustomerTerms			=	@CustomerTerms, " +
								"RequiredDeliveryDate	=	@RequiredDeliveryDate, " +
								"BranchID				=	@BranchID, " +
								"SellerID			    =	@SellerID, " +
								"SellerName             =   @SellerName, " +
								"Remarks                =   @Remarks, " +
								"ChartOfAccountIDARTracking     = @ChartOfAccountIDARTracking, " +
								"ChartOfAccountIDARBills        = @ChartOfAccountIDARBills, " +
								"ChartOfAccountIDARFreight      = @ChartOfAccountIDARFreight, " +
								"ChartOfAccountIDARVDeposit     = @ChartOfAccountIDARVDeposit, " +
								"ChartOfAccountIDARContra       = @ChartOfAccountIDARContra, " +
								"ChartOfAccountIDARLatePayment  = @ChartOfAccountIDARLatePayment " +
							"WHERE SOID = @SOID;";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

				MySqlParameter prmSONo = new MySqlParameter("@SONo",MySqlDbType.String);
				prmSONo.Value = Details.SONo;
				cmd.Parameters.Add(prmSONo);

				MySqlParameter prmSODate = new MySqlParameter("@SODate",MySqlDbType.DateTime);
				prmSODate.Value = Details.SODate.ToString("yyyy-MM-dd HH:mm:ss");
				cmd.Parameters.Add(prmSODate);

				MySqlParameter prmCustomerID = new MySqlParameter("@CustomerID",MySqlDbType.Int64);
				prmCustomerID.Value = Details.CustomerID;
				cmd.Parameters.Add(prmCustomerID);

				MySqlParameter prmCustomerCode = new MySqlParameter("@CustomerCode",MySqlDbType.String);
				prmCustomerCode.Value = Details.CustomerCode;
				cmd.Parameters.Add(prmCustomerCode);

				MySqlParameter prmCustomerContact = new MySqlParameter("@CustomerContact",MySqlDbType.String);
				prmCustomerContact.Value = Details.CustomerContact;
				cmd.Parameters.Add(prmCustomerContact);

				MySqlParameter prmCustomerAddress = new MySqlParameter("@CustomerAddress",MySqlDbType.String);
				prmCustomerAddress.Value = Details.CustomerAddress;
				cmd.Parameters.Add(prmCustomerAddress);

				MySqlParameter prmCustomerTelephoneNo = new MySqlParameter("@CustomerTelephoneNo",MySqlDbType.String);
				prmCustomerTelephoneNo.Value = Details.CustomerTelephoneNo;
				cmd.Parameters.Add(prmCustomerTelephoneNo);

				MySqlParameter prmCustomerModeOfTerms = new MySqlParameter("@CustomerModeOfTerms",MySqlDbType.Int16);
				prmCustomerModeOfTerms.Value = Details.CustomerModeOfTerms;
				cmd.Parameters.Add(prmCustomerModeOfTerms);

				MySqlParameter prmCustomerTerms = new MySqlParameter("@CustomerTerms",MySqlDbType.Int16);
				prmCustomerTerms.Value = Details.CustomerTerms;
				cmd.Parameters.Add(prmCustomerTerms);

				MySqlParameter prmRequiredDeliveryDate = new MySqlParameter("@RequiredDeliveryDate",MySqlDbType.DateTime);
				prmRequiredDeliveryDate.Value = Details.RequiredDeliveryDate.ToString("yyyy-MM-dd HH:mm:ss");
				cmd.Parameters.Add(prmRequiredDeliveryDate);

				MySqlParameter prmBranchID = new MySqlParameter("@BranchID",MySqlDbType.Int16);
				prmBranchID.Value = Details.BranchID;
				cmd.Parameters.Add(prmBranchID);

				MySqlParameter prmSellerID = new MySqlParameter("@SellerID",MySqlDbType.Int64);
				prmSellerID.Value = Details.SellerID;
				cmd.Parameters.Add(prmSellerID);

				MySqlParameter prmSellerName = new MySqlParameter("@SellerName",MySqlDbType.String);
				prmSellerName.Value = Details.SellerName;
				cmd.Parameters.Add(prmSellerName);

				MySqlParameter prmRemarks = new MySqlParameter("@Remarks",MySqlDbType.String);
				prmRemarks.Value = Details.Remarks;
				cmd.Parameters.Add(prmRemarks);

				MySqlParameter prmChartOfAccountIDARTracking = new MySqlParameter("@ChartOfAccountIDARTracking",MySqlDbType.Int32);
				prmChartOfAccountIDARTracking.Value = clsARLinkConfigDetails.ChartOfAccountIDARTracking;
				cmd.Parameters.Add(prmChartOfAccountIDARTracking);

				MySqlParameter prmChartOfAccountIDARBills = new MySqlParameter("@ChartOfAccountIDARBills",MySqlDbType.Int32);
				prmChartOfAccountIDARBills.Value = clsARLinkConfigDetails.ChartOfAccountIDARBills;
				cmd.Parameters.Add(prmChartOfAccountIDARBills);

				MySqlParameter prmChartOfAccountIDARFreight = new MySqlParameter("@ChartOfAccountIDARFreight",MySqlDbType.Int32);
				prmChartOfAccountIDARFreight.Value = clsARLinkConfigDetails.ChartOfAccountIDARFreight;
				cmd.Parameters.Add(prmChartOfAccountIDARFreight);

				MySqlParameter prmChartOfAccountIDARVDeposit = new MySqlParameter("@ChartOfAccountIDARVDeposit",MySqlDbType.Int32);
				prmChartOfAccountIDARVDeposit.Value = clsARLinkConfigDetails.ChartOfAccountIDARVDeposit;
				cmd.Parameters.Add(prmChartOfAccountIDARVDeposit);

				MySqlParameter prmChartOfAccountIDARContra = new MySqlParameter("@ChartOfAccountIDARContra",MySqlDbType.Int32);
				prmChartOfAccountIDARContra.Value = clsARLinkConfigDetails.ChartOfAccountIDARContra;
				cmd.Parameters.Add(prmChartOfAccountIDARContra);

				MySqlParameter prmChartOfAccountIDARLatePayment = new MySqlParameter("@ChartOfAccountIDARLatePayment",MySqlDbType.Int32);
				prmChartOfAccountIDARLatePayment.Value = clsARLinkConfigDetails.ChartOfAccountIDARLatePayment;
				cmd.Parameters.Add(prmChartOfAccountIDARLatePayment);

				MySqlParameter prmSOID = new MySqlParameter("@SOID",MySqlDbType.Int64);
				prmSOID.Value = Details.SOID;
				cmd.Parameters.Add(prmSOID);

                base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
                throw base.ThrowException(ex);
			}
		}
예제 #8
0
파일: SO.cs 프로젝트: marioricci/erp-luma
		public SODetails Details(long SOID)
		{
			try
			{
				string SQL = SQLSelect() + "WHERE SOID = @SOID;";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmSOID = new MySqlParameter("@SOID",MySqlDbType.Int16);
				prmSOID.Value = SOID;
				cmd.Parameters.Add(prmSOID);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

				SODetails Details = new SODetails();

				while (myReader.Read())
				{
					Details.SOID = SOID;
					Details.SONo = "" + myReader["SONo"].ToString();
					Details.SODate = myReader.GetDateTime("SODate");
					Details.CustomerID = myReader.GetInt64("CustomerID");
					Details.CustomerCode = "" + myReader["CustomerCode"].ToString();
					Details.CustomerContact = "" + myReader["CustomerContact"].ToString();
					Details.CustomerAddress = "" + myReader["CustomerAddress"].ToString();
					Details.CustomerTelephoneNo = "" + myReader["CustomerTelephoneNo"].ToString();
					Details.CustomerModeOfTerms = myReader.GetInt16("CustomerModeofTerms");
					Details.CustomerTerms = myReader.GetInt16("CustomerTerms");
					Details.RequiredDeliveryDate = myReader.GetDateTime("RequiredDeliveryDate");
					Details.BranchID = myReader.GetInt16("BranchID");
					Details.BranchCode = "" + myReader["BranchCode"].ToString();
					Details.BranchName = "" + myReader["BranchName"].ToString();
					Details.BranchAddress = "" + myReader["BranchAddress"].ToString();
					Details.SellerID = myReader.GetInt64("SellerID");
					Details.SellerName = "" + myReader["SellerName"].ToString();
					Details.SubTotal = myReader.GetDecimal("SubTotal");
					Details.Discount = myReader.GetDecimal("Discount");
					Details.DiscountApplied = myReader.GetDecimal("DiscountApplied");
					Details.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), myReader.GetString("DiscountType"));
					Details.VAT = myReader.GetDecimal("VAT");
					Details.VatableAmount = myReader.GetDecimal("VatableAmount");
					Details.EVAT = myReader.GetDecimal("EVAT");
					Details.EVatableAmount = myReader.GetDecimal("EVatableAmount");
					Details.LocalTax = myReader.GetDecimal("LocalTax");
					Details.Freight = myReader.GetDecimal("Freight");
					Details.Deposit = myReader.GetDecimal("Deposit");
					Details.PaidAmount = myReader.GetDecimal("PaidAmount");
					Details.UnpaidAmount = myReader.GetDecimal("UnpaidAmount");
                    Details.Status = (SOStatus)Enum.Parse(typeof(SOStatus), myReader.GetString("Status"));
					Details.TotalItemDiscount = myReader.GetDecimal("TotalItemDiscount");
					Details.Remarks = "" + myReader["Remarks"].ToString();
					Details.CustomerDRNo = "" + myReader["CustomerDRNo"].ToString();
					Details.DeliveryDate = myReader.GetDateTime("DeliveryDate");
					Details.ChartOfAccountIDARTracking = myReader.GetInt16("ChartOfAccountIDARTracking");
					Details.ChartOfAccountIDARFreight = myReader.GetInt16("ChartOfAccountIDARFreight");
					Details.ChartOfAccountIDARVDeposit = myReader.GetInt16("ChartOfAccountIDARVDeposit");
					Details.ChartOfAccountIDARContra = myReader.GetInt16("ChartOfAccountIDARContra");
					Details.ChartOfAccountIDARLatePayment = myReader.GetInt16("ChartOfAccountIDARLatePayment");
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}
		}
예제 #9
0
        private Int64 SaveRecord()
        {
            SO clsSO = new SO();
            clsSO.GetConnection();
            lblSONo.Text = Constants.SALES_ORDER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsSO.LastTransactionNo();

            SODetails clsDetails = new SODetails();

            clsDetails.SONo = lblSONo.Text;
            clsDetails.SODate = Convert.ToDateTime(lblSODate.Text);
            clsDetails.CustomerID = Convert.ToInt64(cboCustomer.SelectedItem.Value);
            clsDetails.CustomerCode = cboCustomer.SelectedItem.Text;
            clsDetails.CustomerContact = txtCustomerContact.Text;
            clsDetails.CustomerAddress = txtCustomerAddress.Text;
            clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text;
            clsDetails.CustomerTerms = Convert.ToInt32(lblTerms.Text);
            switch (lblModeOfterms.Text)
            {
                case "Days":
                    clsDetails.CustomerModeOfTerms = 0;
                    break;
                case "Months":
                    clsDetails.CustomerModeOfTerms = 1;
                    break;
                case "Years":
                    clsDetails.CustomerModeOfTerms = 2;
                    break;
            }
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.SellerName = Session["Name"].ToString();
            clsDetails.Status = SOStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            Int64 id = clsSO.Insert(clsDetails);
            clsSO.CommitAndDispose();

            return id;
        }