예제 #1
0
        private void GetOrderDetails()
        {
            string query = "Select PurchaseOrderDetails.ItemName,PurchaseOrderDetails.ItemID,PurchaseOrderDetails.ComodityCode,PurchaseOrderDetails.Unit,PurchaseOrderDetails.qty,PurchaseOrder.PurchaseOrderNo,PurchaseOrder.OrderDate,PurchaseOrder.LedgerID from PurchaseOrder" +
                           " inner join PurchaseOrderDetails on PurchaseOrder.OrderId=PurchaseOrderDetails.OrderId where PurchaseOrder.OrderId='" + mOrderid + "'";
            DataTable dt = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg);

            if (dt.IsValidDataTable())
            {
                object orderno = dt.Rows[0]["PurchaseOrderNo"];
                lblOrderNo.Text  = orderno.ISValidObject() ? orderno.ToString() : "Not Assign";
                lblOrderate.Text = DateTime.Parse(dt.Rows[0]["OrderDate"].ToString()).ToString("dd-MMM-yyyy");
                mLedgerId        = dt.Rows[0]["LedgerId"].ToString();
                string ledgerName = "";
                Supplier._DicSuppliers.TryGetValue(mLedgerId, out ledgerName);
                lblSupplierName.Text = ledgerName;

                string itemName = dt.Rows[0]["ItemName"].ToString();
                mitemid = dt.Rows[0]["ItemID"].ToString();
                string hsnCode = dt.Rows[0]["ComodityCode"].ToString();
                string unit    = dt.Rows[0]["Unit"].ToString();
                string qty     = dt.Rows[0]["qty"].ToString();
                GetOrgBillingAndShippingDetails();
                GetSupplierDetails(mLedgerId);
                if (mIsRegular)
                {
                    ItemTools.GetItemGSTRateIsiGst(mitemid, mIsIGST, out mcgstrate, out msgstrate, out migstrate, out mcessrate);
                }
                dgvItemList.Rows.Add(1, mitemid, itemName, hsnCode, qty, unit, "", "", "", "", "", mcgstrate, "", msgstrate, "", migstrate, ""
                                     , mcessrate, "", "");
            }
        }
예제 #2
0
        private void GetOrderDetails()
        {
            string query = "Select SalesOrderDetails.ItemName,SalesOrderDetails.ItemID,SalesOrderDetails.ComodityCode,SalesOrderDetails.Unit,SalesOrderDetails.qty,SalesOrderDetails.Rate,salesorder.CustomerOrderNo,salesorder.OrderDate,salesorder.LedgerID,salesorder.TotalAmount from salesorder" +
                           " inner join SalesOrderDetails on SalesOrder.OrderId=SalesOrderDetails.orderid where SalesOrder.OrderId='" + mOrderid + "'";
            DataTable dt = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg);

            if (dt.IsValidDataTable())
            {
                object orderno = dt.Rows[0]["CustomerOrderNo"];
                lblOrderNo.Text    = orderno.ISValidObject() ? orderno.ToString() : "Not Assign";
                lblOrderate.Text   = DateTime.Parse(dt.Rows[0]["OrderDate"].ToString()).ToString("dd-MMM-yyyy");
                mLedgerId          = dt.Rows[0]["LedgerId"].ToString();
                lblOrdervalue.Text = dt.Rows[0]["TotalAmount"].ToString();
                string ledgerName = "";
                Customertools._DicCustomers.TryGetValue(mLedgerId, out ledgerName);
                lblCustomername.Text = ledgerName;
                GetCustomerAddressDetails(mLedgerId);
                GetCustomerShippedDetails(mLedgerId);

                string itemName = dt.Rows[0]["ItemName"].ToString();
                mitemid = dt.Rows[0]["ItemID"].ToString();
                string hsnCode = dt.Rows[0]["ComodityCode"].ToString();
                string unit    = dt.Rows[0]["Unit"].ToString();
                string qty     = dt.Rows[0]["qty"].ToString();
                string rate    = dt.Rows[0]["Rate"].ToString();
                ItemTools.GetItemGSTRateIsiGst(mitemid, mIsIGST, out mcgstrate, out msgstrate, out migstrate, out mcessrate);
                dgvItemList.Rows.Add(1, mitemid, itemName, hsnCode, qty, unit, rate, "", "", "", "", mcgstrate, "", msgstrate, "", migstrate, ""
                                     , mcessrate, "", "");
            }
        }
예제 #3
0
        private void cmbItemName_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbQuantity.Text = "";

            if (!cmbItemName.Text.ISNullOrWhiteSpace())
            {
                string itemid = ((KeyValuePair <string, string>)cmbItemName.SelectedItem).Key.ToString();
                cmbUnit.Text = ItemTools.GetUnitName(itemid);
            }
        }
예제 #4
0
        private void CalculateAdvanceReceiptAmpount()
        {
            string cgstAmount = "", sgstAmount = "", igstAmount = "", cessAmount = "", taxWithamount = "";
            double taxvalue = 0d, taxableamount = 0d, totalrate = 0d,
                   advanceamount = 0d, cessrate = 0d,
                   cgstrate = 0d, sgstrate = 0d,
                   igstrate = 0d;

            double.TryParse(mcgstrate, out cgstrate);
            double.TryParse(msgstrate, out sgstrate);
            double.TryParse(mcessrate, out cessrate);
            double.TryParse(migstrate, out igstrate);
            double.TryParse(txtAdvanceAmount.Text, out advanceamount);
            totalrate = cgstrate + sgstrate + cessrate + igstrate;
            try
            {
                taxvalue = ((advanceamount * totalrate) / (100 + totalrate));
                if (mIsIGST)
                {
                    igstAmount = taxvalue.ToString("0.00");
                }
                else
                {
                    cgstAmount = (taxvalue / 2).ToString("0.00");
                    sgstAmount = (taxvalue / 2).ToString("0.00");
                }
            }
            catch (Exception) { }
            taxableamount = advanceamount - taxvalue;
            taxWithamount = (taxableamount + taxvalue).ToString("0.00");

            if (!mOrderid.ISNullOrWhiteSpace())
            {
                ItemTools.GetItemGSTRateAndAmountForPurchase(mitemid, mIsIGST, mIsRegular, taxableamount, out mcgstrate, out cgstAmount, out msgstrate,
                                                             out sgstAmount, out migstrate, out igstAmount, out mcessrate, out cessAmount, out taxWithamount);
            }
            dgvItemList.Rows[0].Cells["CGSTAMOUNT"].Value   = cgstAmount;
            dgvItemList.Rows[0].Cells["CGSTRATE"].Value     = mcgstrate;
            dgvItemList.Rows[0].Cells["SGSTAMOUNT"].Value   = sgstAmount;
            dgvItemList.Rows[0].Cells["SGSTRATE"].Value     = msgstrate;
            dgvItemList.Rows[0].Cells["IGSTAMOUNT"].Value   = igstAmount;
            dgvItemList.Rows[0].Cells["IGSTRATE"].Value     = migstrate;
            dgvItemList.Rows[0].Cells["CESSAMOUNT"].Value   = cessAmount;
            dgvItemList.Rows[0].Cells["CESSRATE"].Value     = mcessrate;
            dgvItemList.Rows[0].Cells["TAXABLEVALUE"].Value = taxableamount.ToString("0.00");
            dgvItemList.Rows[0].Cells["TotalWithTax"].Value = taxWithamount;

            lblTotaltaxbleValue.Text         = taxableamount.ToString("0.00");
            lblTotalGstValue.Text            = taxvalue.ToString("0.00");
            lblTotalReceiptVoucherValue.Text = taxWithamount;
        }
예제 #5
0
        private void cmbItemName_Leave(object sender, EventArgs e)
        {
            int index = cmbItemName.FindStringExact(cmbItemName.Text);

            if (index >= 0)
            {
                cmbItemName.SelectedIndex = index;
                string itemid = ((KeyValuePair <string, string>)cmbItemName.SelectedItem).Key.ToString();
                cmbUnit.Text = ItemTools.GetUnitName(itemid);
            }
            else
            {
                cmbQuantity.Text = "";
                cmbItemName.Text = "";
            }
        }
예제 #6
0
        private string CalculateSalesRateWithTaxFromMrp(string amount)
        {
            double amountd = 0d, slalesRate = 0d, totalgst = 0d, igstd = 0d, cessd = 0d;

            string itemid = ((KeyValuePair <string, string>)cmbItemName.SelectedItem).Key.ToString();
            object sgst = "", cgst, igst = "", cess = "";

            ItemTools.GetItemGSTRate(itemid, out cgst, out sgst, out igst, out cess);

            double.TryParse(amount, out amountd);
            double.TryParse(igst.ISValidObject() ? igst.ToString() : "0", out igstd);
            double.TryParse(cess.ISValidObject() ? cess.ToString() : "0", out cessd);

            totalgst   = igstd + cessd;
            slalesRate = amountd + (amountd * (totalgst / 100));
            return(slalesRate.toString());
        }
예제 #7
0
        private void DescriptionAdd()
        {
            string itemName = ((KeyValuePair <string, string>)cmbItemName.SelectedItem).Value.ToString();
            string itemID   = ((KeyValuePair <string, string>)cmbItemName.SelectedItem).Key.ToString();
            string hsnCode  = ItemTools.GetItemHSNCode(itemID);
            string unit     = cmbUnit.Text;
            string qty      = cmbQuantity.Text;

            dgvItemList.Rows.Add(itemID, mDescriptionSlno, hsnCode, itemName, qty, unit);
            DataGridViewButtonCell btnCelCol = new DataGridViewButtonCell();

            btnCelCol.ToolTipText = "Delete";
            btnCelCol.Value       = "Delete";
            btnCelCol.Style.SelectionBackColor = Color.AntiqueWhite;
            //btnCelCol.InheritedStyle.SelectionBackColor = Color.AntiqueWhite;
            dgvItemList.Rows[mDescriptionSlno - 1].Cells["btnDelete"] = btnCelCol;
            mDescriptionSlno++;
        }
예제 #8
0
        private void SavaData()
        {
            string type  = txtType.Text.GetDBFormatString();
            string query = " Insert into ItemCategory(CategoryName)values('" + type + "') ";

            if (!txtType.Text.ISNullOrWhiteSpace())
            {
                if (SQLHelper.GetInstance().ExcuteQuery(query, out msg))
                {
                    ItemTools.GetItemCategory();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Data not save.", "Category", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please enter category.", "Category", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtType.Focus();
            }
        }
예제 #9
0
        private void DataSave()
        {
            #region Data
            string itemtype     = cmbType.Text.GetDBFormatString();
            string itemName     = txtItemName.Text.GetDBFormatString();
            string categoryid   = cmbCategory.Text.ISNullOrWhiteSpace() ? "NULL" : ((KeyValuePair <string, string>)cmbCategory.SelectedItem).Key.ToString();
            string hsnorsaccode = cmbComodityNo.Text.GetDBFormatString();
            string gstrate      = "NULL";
            string cessrate     = "NULL";
            string unitcode     = "NULL";
            string naration     = "NULL";
            string cgst         = "NULL";
            string sgst         = "NULL";
            string igst         = "NULL";
            string CompanyNAme  = txtCompanyNAme.Text.GetDBFormatString();
            string templateName = txtTemplatNAme.Text.GetDBFormatString();
            string subcategory  = cmbSubCategory.Text.GetDBFormatString();

            if (cmbType.Text == "Goods")
            {
                unitcode = ((KeyValuePair <string, string>)cmbUnit.SelectedItem).Key.ToString();
            }
            if (!txtNaration.Text.ISNullOrWhiteSpace())
            {
                naration = "'" + txtNaration.Text.GetDBFormatString() + "'";
            }
            if (!txtCESSRate.Text.ISNullOrWhiteSpace())
            {
                cessrate = "'" + txtCESSRate.Text.GetDBFormatString() + "'";
            }
            if (!cmbGstRate.Text.ISNullOrWhiteSpace())
            {
                gstrate = "'" + cmbGstRate.Text.GetDBFormatString() + "'";
            }
            if (!txtCgst.Text.ISNullOrWhiteSpace())
            {
                cgst = "'" + txtCgst.Text.GetDBFormatString() + "'";
            }
            if (!txtSgst.Text.ISNullOrWhiteSpace())
            {
                sgst = "'" + txtSgst.Text.GetDBFormatString() + "'";
            }
            if (!txtIGst.Text.ISNullOrWhiteSpace())
            {
                igst = "'" + txtIGst.Text.GetDBFormatString() + "'";
            }
            bool isRCM = chkRCM.Checked;
            bool isITC = chkITC.Checked;
            #endregion
            string query = "";
            if (!mItemIDForEdit.ISNullOrWhiteSpace())
            {
                query = "Update  item set itemName='" + templateName + "',itemType='" + itemtype +
                        "',Categoryid=" + categoryid + ",ComodityCode='" + hsnorsaccode +
                        "',GSTRate=" + gstrate + ",CessRate=" + cessrate + ",CGSTRate=" + cgst + ",sGSTRate="
                        + sgst + ",UnitId=" + unitcode + ",Narration=" + naration + ",IGSTRATE=" + igst
                        + ",Company='" + CompanyNAme + "',TemplateName='" + itemName + "',SubCategory='" +
                        subcategory + "',IsRCM='" + isRCM + "',IsITC='" + isITC + "'  " +
                        "where id='" + mItemIDForEdit + "' ";
            }
            else
            {
                query = "Insert into item(itemName,itemType,Categoryid,ComodityCode,GSTRate, " +
                        "CessRate,CGSTRate,sGSTRate,UnitId,Narration,IGSTRATE,Company, " +
                        "TemplateName,SubCategory,IsRCM,IsITC) values('" + templateName + "','" +
                        itemtype + "'," + categoryid + "," + "'" + hsnorsaccode + "'," +
                        gstrate + "," + cessrate + "," + cgst + "," + sgst + "," + unitcode
                        + "," + naration + "," + igst + ",'" + CompanyNAme + "','" + itemName
                        + "','" + subcategory + "','" + isRCM + "','" + isITC + "')";
            }
            if (SQLHelper.GetInstance().ExcuteQuery(query, out msg))
            {
                ItemTools.GetItem();
                ItemTools.GetItemCategory();
                ItemTools.GetSubCategory();
                ItemTools.GetItemCompany();
                this.Close();
            }
            else
            {
                MessageBox.Show("Internal error. \n" + msg, "Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }