private void ShowORGDetails() { string orgName = "", orgAddress = "", orgLegalNos = "", orgStateCode = "", orgState = ""; ORG_Tools.GetORGDetails(out orgName, out orgAddress, out orgLegalNos, out orgStateCode, out orgState); lblOrgNAme.Text = orgName; lblAddressORG.Text = orgAddress; lblORGLegalNos.Text = orgLegalNos; lblOrgStateCode.Text = orgStateCode; lblOrgState.Text = orgState; //lblOrgNAme.Text = ORG_Tools._OrganizationName; //lblAddressORG.Text = INVOICE_TOOLS._IsOrgAddress ? ORG_Tools._Address + " \n" : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgCityTown ? ORG_Tools._CityTown + ", " : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgDistrict ? ORG_Tools._Dist + " \n" : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgState ? ORG_Tools._State + ", " : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgPin ? ORG_Tools._PIN + " \n" : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgContactNo ? ORG_Tools._ContactNo1 + " \n" : ""; //lblAddressORG.Text += INVOICE_TOOLS._IsOrgMailID ? ORG_Tools._Email + " " : ""; //lblAddressORG.Text = lblAddressORG.Text + "\nState :" + ORG_Tools._StateCode + "-" + ORG_Tools._State; //lblORGLegalNos.Text = INVOICE_TOOLS._IsOrgGSTIN ? "GSTIN : " + ORG_Tools._GSTin + " \n" : ""; //lblORGLegalNos.Text += INVOICE_TOOLS._IsOrgCIN ? "CIN : " + ORG_Tools._CorporateNo + " \n" : ""; //lblORGLegalNos.Text += INVOICE_TOOLS._IsOrgPAN ? "PAN : " + ORG_Tools._PAN + " \n" : ""; //lblOrgStateCode.Text = ORG_Tools._StateCode; //lblOrgState.Text = ORG_Tools._State; }
private void GenerateRegularTaxInvoice() { _DtSet.Tables["ItemDetails"].Rows.Clear(); _DtSet.Tables["InvoiceDetailsFooter"].Rows.Clear(); _DtSet.Tables["InvoiceDetailsAmounts"].Rows.Clear(); _DtSet.Tables["InvoiceDetailsHeader"].Rows.Clear(); string query = "SELECT SlNo, InvoiceNo, convert(varchar(11),InvoiceDate,106) as InvoiceDate, " + "LedgerId, BillingTerms, convert(varchar(11),DueDate,106) as DueDate, " + "BillingTo, BillingAddress, BillingGSTNO, BillingState, BillingStateCode, BuyerOrderNo, " + "convert(varchar(11),BuyerOrderDate,106) as BuyerOrderDate, ChallanNo, " + "convert(varchar(11),ChallanDate,106) as ChallanDate, DispatchThrough, VehiclaNo, " + "ShippingTo,ShippingAddress, ShippingState, ShippingStateCode,TotalQty, TotalAmount, " + "TotalDiscount, TotalTaxAmount, TotalCGST, TotalSGST, TotalIGST, TotalCess, NetAmount, " + "FreightChargs,PackingCharges, OtherCharges, OverAllDiscount,TotalInvoiceAmount, Note,RCM,InvoiceType from Invoice " + "where InvoiceNo = '" + mInvoiceNo + "'"; DataTable dt0 = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg); if (dt0.IsValidDataTable()) { string orgName = "", orgAddress = "", orgLegalNos = "", orgStateCode = "", orgState = ""; ORG_Tools.GetORGDetails(out orgName, out orgAddress, out orgLegalNos, out orgStateCode, out orgState); _DtSet.Tables["InvoiceDetailsHeader"].Rows.Add(orgName, orgAddress, orgStateCode, orgState, orgLegalNos, ORG_Tools._LogoByte, dt0.Rows[0]["InvoiceNo"], dt0.Rows[0]["InvoiceDate"], dt0.Rows[0]["ChallanNo"], dt0.Rows[0]["ChallanDate"], dt0.Rows[0]["BuyerOrderNo"], dt0.Rows[0]["BuyerOrderDate"], dt0.Rows[0]["BillingTerms"], dt0.Rows[0]["DueDate"], dt0.Rows[0]["DispatchThrough"], dt0.Rows[0]["VehiclaNo"], dt0.Rows[0]["BillingTo"], dt0.Rows[0]["BillingAddress"], dt0.Rows[0]["BillingGSTNO"], dt0.Rows[0]["BillingStateCode"], dt0.Rows[0]["BillingState"], dt0.Rows[0]["ShippingTo"], dt0.Rows[0]["ShippingAddress"], dt0.Rows[0]["ShippingStateCode"], dt0.Rows[0]["ShippingState"], mInvoiceCopyText); //Billing and shipped details _DtSet.Tables["InvoiceDetailsAmounts"].Rows.Add(orgName, dt0.Rows[0]["TotalQty"], dt0.Rows[0]["TotalDiscount"], dt0.Rows[0]["TotalAmount"], dt0.Rows[0]["TotalTaxAmount"], dt0.Rows[0]["TotalCGST"], dt0.Rows[0]["TotalSGST"], dt0.Rows[0]["TotalIGST"], dt0.Rows[0]["TotalCess"], dt0.Rows[0]["NetAmount"], dt0.Rows[0]["TotalInvoiceAmount"], dt0.Rows[0]["FreightChargs"], dt0.Rows[0]["PackingCharges"], dt0.Rows[0]["OtherCharges"], dt0.Rows[0]["OverAllDiscount"], dt0.Rows[0]["RCM"]); ///Footer _DtSet.Tables["InvoiceDetailsFooter"].Rows.Add(orgName, INVOICE_TOOLS._DeclarationText, "", INVOICE_TOOLS._OrgBankDetailsText, INVOICE_TOOLS._OrgTermsAndConditionText, INVOICE_TOOLS._SignatureForText, INVOICE_TOOLS._SignatureAuthorityText); /////invoice item details query = "SELECT * from InvoiceDetails where InvoiceNo='" + mInvoiceNo + "'"; DataTable dt = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg); if (dt.IsValidDataTable()) { foreach (DataRow item in dt.Rows) { object cess = item["CeassAmount"]; _DtSet.Tables["ItemDetails"].Rows.Add(orgName, item["ItemName"], item["HSNCode"], item["Quantity"], item["Unit"], item["Rate"], item["Amount"], item["DiscountRate"], item["DiscountAmount"], item["TaxAmount"], item["CGSTRate"], item["CGSTAmount"], item["SGSTRate"], item["SGSTAmount"], item["IGSTRate"], item["IGSTAmount"], item["CessRate"], cess, item["Total"]); if (cess.ISValidObject() && !isCess) { isCess = true; } } } ///Clarify Invoice type #region Invoice Type string invoiceType = dt0.Rows[0]["InvoiceType"].ToString(); string placeOfsuppllyState = dt0.Rows[0]["BillingState"].ToString(); if (invoiceType == "Regular") { if (ORG_Tools._State == placeOfsuppllyState) { if (isCess) { mInvoiceType = _InvoiceType.CGST_SGST_W_Cess; } else { mInvoiceType = _InvoiceType.CGST_SGST_WO_Cess; } } else { if (isCess) { mInvoiceType = _InvoiceType.IGST_O_Cess; } else { mInvoiceType = _InvoiceType.IGST_WO_Cess; } } } else { mInvoiceType = _InvoiceType.BillOfSupply; } #endregion //Organization details } }
private void DataSave() { string orgName = txtOrgName.Text.GetDBFormatString(); string address = txtAddress.Text.GetDBFormatString(); string city = txtCity.Text.GetDBFormatString(); string district = ((KeyValuePair <string, string>)cmbDist.SelectedItem).Value.ToString(); string stateID = ((KeyValuePair <string, string>)cmbState.SelectedItem).Key.ToString(); string pin = txtPIN.Text.GetDBFormatString(); string tin = txtTAN.Text.GetDBFormatString(); string addressREGional = txtRegionalAdDress.Text.GetDBFormatString(); string cityREGional = txtRegionalCity.Text.GetDBFormatString(); string districtREGional = (!cmbRegionalDist.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbRegionalDist.SelectedItem).Value.ToString() : ""); string stateIDREGional = (!cmbRegionalState.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbRegionalState.SelectedItem).Key.ToString() : ""); string pinREGional = txtRegionalPIN.Text.GetDBFormatString(); string PAN = txtPAN.Text.GetDBFormatString(); string gstCategory = cmbGSTCatagory.Text.GetDBFormatString(); string gstNo = txtGST.Text.GetDBFormatString(); string contctNo = txtContctNo.Text.GetDBFormatString(); string alterContctNo = txtAlternativNo.Text.GetDBFormatString(); string email = txtEmail.Text.GetDBFormatString(); string website = txtWebSite.Text.GetDBFormatString(); string cin = txtCIN.Text.GetDBFormatString(); string businessCategory = cmbBusinessCategory.Text; string nameShipping = txtShippingNAme.Text.GetDBFormatString(); string contctShipping = txtContactShiping.Text.GetDBFormatString(); string addressShipping = txtAddressShipping.Text.GetDBFormatString(); string cityShipping = txtCityTownShipping.Text.GetDBFormatString(); string districtShipping = (!cmbDistShipping.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbDistShipping.SelectedItem).Value.ToString() : ""); string stateIDShipping = (!cmbStateShipping.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbStateShipping.SelectedItem).Value.ToString() : ""); string pinShipping = txtPinShipping.Text.GetDBFormatString(); string nameBilling = txtNameBilling.Text.GetDBFormatString(); string addressBilling = txtAddressBilling.Text.GetDBFormatString(); string cityBilling = txtCityTownBilling.Text.GetDBFormatString(); string districtBilling = (!cmbDistBilling.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbDistBilling.SelectedItem).Value.ToString() : ""); string stateIDBilling = (!cmbStateBilling.Text.ISNullOrWhiteSpace() ? ((KeyValuePair <string, string>)cmbStateBilling.SelectedItem).Value.ToString() : ""); string pinBilling = txtPinBilling.Text.GetDBFormatString(); string compositiontype = "NULL"; string percentage = "NULL"; string delecration = "NULL"; if (gstCategory == "Composition") { compositiontype = "'" + cmbCompositionType.Text.GetDBFormatString() + "'"; percentage = "" + lblPercentage.Text.GetDBFormatString() + ""; delecration = "'" + txtCompositeDeclaration.Text.GetDBFormatString() + "'"; } string query = ""; if (mIsUpdate) { query = "Update OrganizationDetails set OrganizationName='" + orgName + "',Address='" + address + "',CityTown='" + city + "',Dist='" + district + "',stateID=" + stateID + ",PIN='" + pin + "',PAN='" + PAN + "',CorporateNo='" + cin + "',GSTtype='" + gstCategory + "',GSTin='" + gstNo + "',ContactNo1='" + contctNo + "',AlternativeNo='" + alterContctNo + "',Email='" + email + "',website='" + website + "',TIN='" + tin + "',AddressRegional='" + addressREGional + "',CityTownRegional='" + cityREGional + "',DistRegional='" + districtREGional + "',SateRegionalID='" + stateIDREGional + "',PinRegional='" + pinREGional + "',BusinessCatagory='" + businessCategory + "',CompositionType=" + compositiontype + ",CompositionPercentage=" + percentage + ",CompositionDeclaration=" + delecration + ""; mlstQry.Add(query); query = "update OrganizationAddress set OrganizationName='" + orgName + "',BillingName='" + nameBilling + "',BillingAddress='" + addressBilling + "',BillingTown='" + cityBilling + "',BillingDist='" + districtBilling + "',BillingState='" + stateIDBilling + "',BillingPIN='" + pinBilling + "',ShippingName ='" + nameShipping + "',ShippingAddress='" + addressShipping + "',ShippingTown='" + cityShipping + "',ShippingDist='" + districtShipping + "',ShippingState='" + stateIDShipping + "',ShippingPIN='" + pinShipping + "',ShippingContactNo= '" + contctShipping + "'"; mlstQry.Add(query); } else { query = "Insert into OrganizationDetails(OrganizationName, Address, CityTown, Dist, StateID, " + "PIN, PAN, CorporateNo, GSTtype,GSTin, ContactNo1, AlternativeNo, Email, website,TIN,AddressRegional, " + "CityTownRegional,DistRegional,SateRegionalID,PinRegional,BusinessCatagory,CompositionType,CompositionPercentage,CompositionDeclaration) " + "values('" + orgName + "','" + address + "','" + city + "','" + district + "'," + stateID + ",'" + pin + "','" + PAN + "','" + cin + "','" + gstCategory + "','" + gstNo + "','" + contctNo + "','" + alterContctNo + "','" + email + "','" + website + "','" + tin + "','" + addressREGional + "','" + cityREGional + "','" + districtREGional + "'," + stateIDREGional + ",'" + pinREGional + "','" + businessCategory + "'," + compositiontype + "," + percentage + "," + delecration + ")"; mlstQry.Add(query); query = "insert into OrganizationAddress(OrganizationName,BillingName,BillingAddress,BillingTown,BillingDist,BillingState,BillingPIN,ShippingName,ShippingAddress,ShippingTown,ShippingDist,ShippingState,ShippingPIN,ShippingContactNo) " + "values('" + orgName + "','" + nameBilling + "','" + addressBilling + "','" + cityBilling + "','" + districtBilling + "','" + stateIDBilling + "','" + pinBilling + "','" + nameShipping + "','" + addressShipping + "','" + cityShipping + "','" + districtShipping + "','" + stateIDShipping + "','" + pinShipping + "','" + contctShipping + "')"; mlstQry.Add(query); } if (SQLHelper.GetInstance().ExecuteTransection(mlstQry, out msg)) { UpdateLogo(); ORG_Tools.InitDetails(); if (mIsFistTime) { this.Close(); } else { MessageBox.Show("Save data.", "Organization Details", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }