private void initVariables() { //249, 29 pnlLeaveSanctionLimitOuter.Location = new Point(249, 20); pnlLeaveTypeOuter.Location = new Point(249, 20); pnlLeaveOfficeMapOuter.Location = new Point(249, 20); pnlLeaveSanctionLimitOuter.Parent = pnlUI; pnlLeaveTypeOuter.Parent = pnlUI; pnlLeaveOfficeMapOuter.Parent = pnlUI; pnlLeaveSanctionLimitInner.Parent = pnlLeaveSanctionLimitOuter; pnlLeaveTypeInner.Parent = pnlLeaveTypeOuter; pnlLeaveOfficeMapInner.Parent = pnlLeaveOfficeMapOuter; OfficeDB.fillOfficeComboNew(cmbLomOffice); CatalogueValueDB.fillCatalogValueComboNew(cmbLslDesignation, "Designation"); CatalogueValueDB.fillCatalogValueComboNew(cmbGender, "Gender"); LeaveSettingsdb.fillLeaveComboNew(cmbLomLeaveID); LeaveSettingsdb.fillLeaveComboNew(cmbLslLeaveID); cmbGender.Items.Add("All"); btnNew.Visible = false; pnlLeaveOfficeMapOuter.Visible = false; pnlLeaveSanctionLimitOuter.Visible = false; pnlLeaveTypeOuter.Visible = false; }
private void initVariables() { try { ComboFIll.fillStaticCombos(); ////connString = Login.connString; ////userLoggedIn = Login.userLoggedIn; ////userLoggedInName = Login.userLoggedInName; ////empLoggedIn = Login.empLoggedIn; currentFY = FinancialYearDB.getCurrentFinancialYear(); documentDirectory = CatalogueValueDB.getParamValue("SysParam", "DocumentDirectory"); showTime(); lblEmployeeName.Text = Login.userLoggedInName; MenuPrivilegeDB mpDB = new MenuPrivilegeDB(); MenuItemDB dbrecord = new MenuItemDB(); menuhdritems = MenuItemDB.getMenuItemsHeader(); foreach (menuitem menu in menuhdritems) { dictMainHeader.Add(menu.menugrp, 0); } } catch (Exception) { MessageBox.Show("Main() : Error 2"); } }
private void initVariables() { try { if (getuserPrivilegeStatus() == 1) { //user is only a viewer listOption = 6; } CatalogueValueDB.fillCatalogValueComboNew(cmbComplaintType, "WorkplaceComplaints"); txtEmpId.Text = Login.empLoggedIn; dtAcceptTime.Value = UpdateTable.getSQLDateTime(); dtCloseTime.Value = UpdateTable.getSQLDateTime(); dtAcceptTime.Format = DateTimePickerFormat.Custom; dtCloseTime.Format = DateTimePickerFormat.Custom; dtAcceptTime.CustomFormat = "dd-MM-yyyy HH:mm:ss"; dtCloseTime.CustomFormat = "dd-MM-yyyy HH:mm:ss"; txtEmpId.Enabled = false; userString = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter1 + Main.delimiter2; setButtonVisibility("init"); } catch (Exception) { MessageBox.Show("Exception"); } }
private void initVariable() { try { //OfficeDB.fillOfficeComboNew(cmbOfficeID); ProjectHeaderDB.fillprojectCombo(cmbProject); CustomerDB.fillCustomerComboNew(cmbCustomer); CurrencyDB.fillCurrencyComboNew(cmbCurrency); CatalogueValueDB.fillCatalogValueComboNew(cmbTransportationMode, "TransportationMode"); CustomerDB.fillLedgerTypeComboNew(cmbTransporter, "Transporter"); //CatalogueValueDB.fillCatalogValueCombo(cmbPaymentTerms, "TermsOfPayment"); CatalogueValueDB.fillCatalogValueComboNew(cmbOriginCountryID, "Country"); // CatalogueValueDB.fillCatalogValueCombo(cmbInvoiceType, "POType"); CatalogueValueDB.fillCatalogValueComboNew(cmbFinalDestinationCountryID, "Country"); CatalogueValueDB.fillCatalogValueComboNew(cmbPreCarriageTransMode, "TransportationMode"); // CatalogueValueDB.fillCatalogValueCombo(cmbFinalDestinationCountryID, "Country"); //CatalogueValueDB.fillCatalogValueCombo(cmbPreCarriageTransMode, "TransportationMode"); CatalogueValueDB.fillCatalogValueComboNew(cmbADCode, "ADCODES"); //dtDeliveryDate.Format = DateTimePickerFormat.Custom; //dtDeliveryDate.CustomFormat = "dd-MM-yyyy"; dtInvoiceDate.Format = DateTimePickerFormat.Custom; dtInvoiceDate.CustomFormat = "dd-MM-yyyy"; //dtTrackingDate.Format = DateTimePickerFormat.Custom; //dtTrackingDate.CustomFormat = "dd-MM-yyyy"; //dtValidateDate.Format = DateTimePickerFormat.Custom; //dtValidateDate.CustomFormat = "dd-MM-yyyy"; ShowAllDetails(); btnClose.Focus(); } catch (Exception ex) { MessageBox.Show("initVariable() : Error"); } }
private void initVariables() { if (getuserPrivilegeStatus() == 1) { listOption = 2; } CustomerDB.fillCustomerComboNew(cmbConsignee); CustomerDB.fillCustomerComboNew(cmbCourierID); CatalogueValueDB.fillCatalogValueComboNew(cmbTransportationMode, "TransportationMode"); //CatalogueValueDB.fillCatalogValueCombo(cmbTransportationMode, "TransportationMode"); txtDocNo.Enabled = false; dtDocDate.Enabled = false; dtDocDate.Format = DateTimePickerFormat.Custom; dtDocDate.CustomFormat = "dd-MM-yyyy"; dtDocDate.Enabled = false; dtDocDate.Format = DateTimePickerFormat.Custom; dtDocDate.CustomFormat = "dd-MM-yyyy"; dtDocDate.Enabled = false; dtLRDate.Format = DateTimePickerFormat.Custom; dtLRDate.CustomFormat = "dd-MM-yyyy"; pnlUI.Controls.Add(pnlList); btnFinalize.Visible = false; pnlUI.Controls.Add(pnlAddEdit); closeAllPanels(); userString = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter1 + Main.delimiter2; userCommentStatusString = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter1 + "0" + Main.delimiter2; setButtonVisibility("init"); }
private void initVariable() { try { //OfficeDB.fillOfficeComboNew(cmbOfficeID); //ProjectHeaderDB.fillprojectCombo(cmbProjectID); CustomerDB.fillCustomerComboNew(cmbCustomer); CurrencyDB.fillCurrencyComboNew(cmbCurrency); CatalogueValueDB.fillCatalogValueComboNew(cmbPaymentMode, "PaymentMode"); CatalogueValueDB.fillCatalogValueComboNew(cmbFreightTerms, "Freight"); CatalogueValueDB.fillCatalogValueComboNew(cmbTaxterms, "TaxStatus"); CatalogueValueDB.fillCatalogValueComboNew(cmbTransportationMode, "TransportationMode"); //dtDeliveryDate.Format = DateTimePickerFormat.Custom; //dtDeliveryDate.CustomFormat = "dd-MM-yyyy"; dtPODate.Format = DateTimePickerFormat.Custom; dtPODate.CustomFormat = "dd-MM-yyyy"; //dtTrackingDate.Format = DateTimePickerFormat.Custom; //dtTrackingDate.CustomFormat = "dd-MM-yyyy"; //dtValidateDate.Format = DateTimePickerFormat.Custom; //dtValidateDate.CustomFormat = "dd-MM-yyyy"; ShowAllDetails(); btnClose.Focus(); } catch (Exception ex) { MessageBox.Show("initVariable() : Error"); } }
private void initVariables() { fillStatusCombo(cmbStatus); CompanyDataDB.fillCompanyIDCombo(cmbCmpnyID); CompanyDataDB.fillCompanyIDCombo(cmbcmpnysrch); //CatalogueValueDB.fillCatalogValueCombo(cmbDataID, "CompanyData"); CatalogueValueDB.fillCatalogValueComboNew(cmbDataID, "CompanyData"); grdList.Visible = false; }
private void btnLeaveOfficeMapping_Click(object sender, EventArgs e) { OfficeDB.fillOfficeComboNew(cmbLomOffice); CatalogueValueDB.fillCatalogValueComboNew(cmbLslDesignation, "Designation"); CatalogueValueDB.fillCatalogValueComboNew(cmbGender, "Gender"); LeaveSettingsdb.fillLeaveComboNew(cmbLomLeaveID); cmbGender.Items.Add("All"); LeaveSettingsdb.fillLeaveComboNew(cmbLslLeaveID); leaveofficemapping(); }
private void initVariables() { CompanyDetailDB.fillCompanyIDComboNew(cmbCompany); CatalogueValueDB.fillCatalogValueComboNew(cmbBank, "Bank"); CatalogueValueDB.fillCatalogValueComboNew(cmbAccType, "AccountType"); cmbAccType.SelectedIndex = -1; cmbCompany.SelectedIndex = -1; cmbBank.SelectedIndex = -1; cmbStatus.SelectedIndex = 0; }
private void btnSave_Click(object sender, EventArgs e) { try { cataloguevalue catval = new cataloguevalue(); CatalogueValueDB catvalDB = new CatalogueValueDB(); catval.catalogueValueID = txtID.Text; catval.description = txtDescription.Text; catval.catalogueID = selectedCatalogueID; catval.status = ComboFIll.getStatusCode(cmbStatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; if (catvalDB.validateCatalogue(catval)) { if (btnText.Equals("Update")) { if (catvalDB.updateCatalogueValue(catval)) { MessageBox.Show("Catalogue Value updated"); closeAllPanels(); ListCatalogueValues(selectedCatalogueID); } else { MessageBox.Show("Failed to update Catalogue Value Status"); } } else if (btnText.Equals("Save")) { if (catvalDB.insertCatalogueValue(catval)) { MessageBox.Show("Catalogue Value Added"); closeAllPanels(); ListCatalogueValues(selectedCatalogueID); } else { MessageBox.Show("Failed to Insert Catalogue Value"); } } } else { MessageBox.Show("Catalogue Value Data Validation failed"); } } catch (Exception) { MessageBox.Show("Failed Adding / Editing User Data"); } }
private void initVariables() { try { fillDocumentStatusCombo(cmbStatus); CatalogueValueDB.fillCatalogValueComboNew(cmbSubDOc, "SEFType"); } catch (Exception) { } }
private void initVariables() { try { pnlDocumentList.Visible = false; CatalogueValueDB.fillCatalogValueComboNew(cmbSEFType, "SEFType"); cmbSEFType.SelectedIndex = 0; } catch (Exception) { } }
private void initVariables() { try { fillStatusCombo(cmbStatus); // CatalogueValueDB.fillCatalogValueCombo(cmbBank,"Bank"); CatalogueValueDB.fillCatalogValueComboNew(cmbBank, "Bank"); } catch (Exception) { } }
private void initVariables() { try { fillStatusCombo(cmbDocumentStatus); EmployeeDB.fillEmpListCombo(cmbEmployee); CatalogueValueDB.fillCatalogValueComboNew(cmbStoreLocation, "StoreLocation"); } catch (Exception) { } }
private void initVariables() { dtFromDate.Format = DateTimePickerFormat.Custom; dtFromDate.CustomFormat = "dd-MM-yyyy"; CatalogueValueDB.fillCatalogValueComboNew(cmbPurpose, "MovementPurpose"); dtFromDate.Value = DateTime.Now.AddMonths(-1); dtToDate.Format = DateTimePickerFormat.Custom; dtToDate.CustomFormat = "dd-MM-yyyy"; dtToDate.Value = DateTime.Now; pnlUI.Controls.Add(pnlList); grdList.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; setButtonVisibility("init"); }
private void initVariables() { try { //CatalogueValueDB.fillCatalogValueCombo(cmbBookType, "DayBookType"); CatalogueValueDB.fillCatalogValueComboNew(cmbBookType, "DayBookType"); setButtonVisibility("init"); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
private void initVariables() { pnlgrdList.Visible = false; grdList.Visible = false; lblSearch.Visible = false; txtSearch.Visible = false; cmbFilterStock.SelectedIndex = 1; CatalogueValueDB.fillCatalogValueComboNew(cmbStoreLocation, "StoreLocation"); Structures.ComboBoxItem cbitem = new Structures.ComboBoxItem("All", "All"); cmbStoreLocation.Items.Add(cbitem); cmbStoreLocation.SelectedIndex = cmbStoreLocation.Items.Count - 1; }
private void initVariables() { try { //CatalogueValueDB.fillCatalogValueCombo(cmbBookType, "DayBookType"); CatalogueValueDB.fillCatalogValueComboNew(cmbBookType, "DayBookType"); CurrencyDB.fillCurrencyComboNew(cmbCurrency); cmbCurrency.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbCurrency, "INR"); setButtonVisibility("init"); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
private void initVariables() { dtFromDate.Enabled = true; dtToDate.Enabled = true; CatalogueValueDB.fillCatalogValueComboNew(cmbComplaintType, "WorkplaceComplaints"); docID = Main.currentDocument; dtFromDate.Format = DateTimePickerFormat.Custom; dtFromDate.CustomFormat = "dd-MM-yyyy"; dtToDate.Format = DateTimePickerFormat.Custom; dtToDate.CustomFormat = "dd-MM-yyyy"; pnlUI.Controls.Add(pnlList); closeAllPanels(); grdList.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; setButtonVisibility("init"); clearData(); }
private void initVariables() { try { if (getuserPrivilegeStatus() == 1) { //user is only a viewer listOption = 6; } StockGroupDB3.fillGroupValueCombo(cmbGroup1Select, 1); StockGroupDB3.fillGroupValueCombo(cmbGroup2Select, 2); StockGroupDB3.fillGroupValueCombo(cmbGroup3Select, 3); CatalogueValueDB.fillCatalogValueCombo(cmbUnit, "StockUnit"); //fillTypeCombo(cmbGroup); userString = Login.userLoggedInName + Main.delimiter1 + Login.userLoggedIn + Main.delimiter1 + Main.delimiter2; setButtonVisibility("init"); } catch (Exception) { } }
private void initVariable() { try { OfficeDB.fillOfficeComboNew(cmbOfficeID); CurrencyDB.fillCurrencyComboNew(cmbCurrencyID); ProjectHeaderDB.fillprojectCombo(cmbProjectID); CatalogueValueDB.fillCatalogValueComboNew(cmbBankTransMode, "BankTransactionMode"); CatalogueValueDB.fillCatalogValueComboNew(cmbBookType, "DayBookType"); dtTempDate.Format = DateTimePickerFormat.Custom; dtTempDate.CustomFormat = "dd-MM-yyyy"; dtVoucherDate.Format = DateTimePickerFormat.Custom; dtVoucherDate.CustomFormat = "dd-MM-yyyy"; ShowAllDetails(); btnClose.Focus(); } catch (Exception ex) { MessageBox.Show("initVariable() : Error"); } }
private void initVariables() { try { CustomerDB.fillCustomerComboNew(cmbConsignee); CatalogueValueDB.fillCatalogValueComboNew(cmbTransportationmode, "TransportationMode"); //CatalogueValueDB.fillCustomerComboNew(cmbTransportationmode, "TransportationMode"); dtDocumentDate.Format = DateTimePickerFormat.Custom; dtDocumentDate.CustomFormat = "dd-MM-yyyy"; dtDocumentDate.Enabled = false; dtLRdate.Format = DateTimePickerFormat.Custom; dtLRdate.CustomFormat = "dd-MM-yyyy"; dtDeliveryDate.Format = DateTimePickerFormat.Custom; dtDeliveryDate.CustomFormat = "dd-MM-yyyy"; pnlUI.Controls.Add(pnlDocumentList); closeAllPanels(); setbuttonVisibility("init"); } catch (Exception) { } }
private void Listdata() { try { grdList.Rows.Clear(); CompanyDataDB dbrecord = new CompanyDataDB(); int index = 0; CatalogueValueDB ACDb = new CatalogueValueDB(); List <cataloguevalue> acList = ACDb.getCatalogueValues(); List <cmpnydata> data = dbrecord.getData(cmbcmpnysrch.SelectedItem.ToString().Trim().Substring(0, cmbcmpnysrch.SelectedItem.ToString().Trim().IndexOf('-')).Trim()); foreach (cataloguevalue cv in acList) { index = 0; if (cv.catalogueID == "CompanyData") { foreach (cmpnydata dat in data) { if (cv.catalogueValueID.Equals(dat.DataID)) { grdList.Rows.Add(dat.DataID, dat.DataValue, ComboFIll.getStatusString(dat.status)); index = 1; } } if (index == 0) { grdList.Rows.Add(cv.catalogueValueID, "", ""); } } } grdList.Visible = true; } catch (Exception ex) { MessageBox.Show("Error in CompanyData listing"); } enableBottomButtons(); pnlRegionList.Visible = true; }
private void ListCatalogueValues(string CatalogueID) { try { grdList.Rows.Clear(); CatalogueValueDB dbrecord = new CatalogueValueDB(); List <cataloguevalue> CatalogueValues = dbrecord.getCatalogueValues(); foreach (cataloguevalue catval in CatalogueValues) { if (catval.catalogueID.Equals(CatalogueID)) { grdList.Rows.Add(catval.catalogueValueID, catval.description, ComboFIll.getStatusString(catval.status)); } } lblAddEditHeader.Text = CatalogueID; } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } enableBottomButtons(); pnlCatalogueValueList.Visible = true; }
public void PrintPO(poheader poh, List <podetail> PODetail, string taxStr) { Dictionary <string, string> companyInfo = getCompanyInformation(); //string stateDetail = customer custDetail = CustomerDB.getCustomerDetailForPO(poh.CustomerID); string[] companyBillingAdd = CompanyAddressDB.getCompTopBillingAdd(Login.companyID); string poNoSuffix = ""; string supplAdd = ""; string stype = ""; if (poh.DocumentID == "POGENERAL") { poNoSuffix = "G-"; supplAdd = "Contractor:\n" + custDetail.name + Main.delimiter1 + "\n" + custDetail.BillingAddress + "\n"; stype = "Contractor"; } else if (poh.DocumentID == "PURCHASEORDER") { poNoSuffix = "P-"; stype = "Supplier"; } supplAdd = stype + ":\n" + custDetail.name + Main.delimiter1 + "\n" + custDetail.BillingAddress + "\n"; if (custDetail.StateName.ToString().Length != 0) { supplAdd = supplAdd + "Sate Name:" + custDetail.StateName; } if (custDetail.StateCode.ToString().Length != 0) { supplAdd = supplAdd + "\nState Code:" + custDetail.StateCode; } if (custDetail.OfficeName.ToString().Length != 0) { supplAdd = supplAdd + "\nGST:" + custDetail.OfficeName; // For GST Code } //; : main.delimiter2 //$ : main.delimiter1 string InvoiceTo = "Invoice To: \n" + companyBillingAdd[0] + Main.delimiter1 + "\n" + companyBillingAdd[1] + "\nGST:" + companyInfo["GST"] + "\nCIN:" + companyInfo["CIN"] + "\nPAN:" + companyInfo["PAN"]; string DespatchTo = "Dispatch To:\n" + companyBillingAdd[0] + Main.delimiter1 + "\n" + poh.DeliveryAddress + "\nGST:" + companyInfo["GST"]; string HeaderString = supplAdd + Main.delimiter2 + "PO No : " + poNoSuffix + poh.PONo + " , Date: " + String.Format("{0:dd MMMM, yyyy}", Convert.ToDateTime(poh.PODate)) + Main.delimiter2 + stype + " Reference : " + poh.ReferenceQuotation.Replace(";", ",\n") + Main.delimiter2 + "Mode Of Dispatch:" + CatalogueValueDB.getParamValue("TransportationMode", poh.TransportationMode) + Main.delimiter2 + "Delivery Period : " + poh.DeliveryPeriod + " Days" + Main.delimiter2 + InvoiceTo + Main.delimiter2 + "Price basis : " + CatalogueValueDB.getParamValue("PriceBasis", poh.PriceBasis) + Main.delimiter2 + "Delivery at : " + poh.DeliveryAt + Main.delimiter2 + "Terms of Payment : " + PTDefinitionDB.getPaymentTermString(poh.PaymentTerms) + Main.delimiter2 + "Tax : " + CatalogueValueDB.getParamValue("TaxStatus", poh.TaxTerms) + Main.delimiter2 + DespatchTo + Main.delimiter2 + "Partial Shipment : " + poh.PartialShipment + Main.delimiter2 + "Transhipment : " + poh.Transhipment + Main.delimiter2 + "Packaging Specification : " + poh.PackingSpec + Main.delimiter2 + poh.SpecialNote; string footer1 = "Amount In Words\n\n"; string ColHeader = "SI No.;Description of Goods;Quantity;Unit;Unit Rate;Amount;Warranty\nIn Days"; string footer2 = "This Purchase Order, being computer generated, does not require physical signature."; string declaration = "We, Cellcomm Solutions Limited (also referred to as “CSL”), are pleased to place" + " this Purchase Order (also referred to as 'PO') with the " + stype + " addressed below.In accepting this Purchase Order, the " + stype + " undertakes to supply the Goods described herein as per the details and instructions shown below" + " (such details and instructions being the Specific Terms and Conditions agreed between the Parties) " + "and also subject to the General Terms & Conditions contained herein."; string termsAndCond = getTCString(poh.TermsAndCondition, poh.DocumentID); double totQuant = 0.00; double totAmnt = 0.00; int n = 1; string ColDetailString = ""; var count = PODetail.Count(); foreach (podetail pod in PODetail) { if (n == count) { ColDetailString = ColDetailString + n + Main.delimiter1 + pod.Description + Main.delimiter1 + pod.Quantity + Main.delimiter1 + pod.Unit + Main.delimiter1 + pod.Price + Main.delimiter1 + (pod.Quantity * pod.Price) + Main.delimiter1 + pod.WarrantyDays; } else { ColDetailString = ColDetailString + n + Main.delimiter1 + pod.Description + Main.delimiter1 + pod.Quantity + Main.delimiter1 + pod.Unit + Main.delimiter1 + pod.Price + Main.delimiter1 + (pod.Quantity * pod.Price) + Main.delimiter1 + pod.WarrantyDays + Main.delimiter2; } totQuant = totQuant + pod.Quantity; totAmnt = totAmnt + (pod.Quantity * pod.Price); n++; } try { SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save As PDF"; sfd.Filter = "Pdf files (*.Pdf)|*.pdf"; sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (poh.Status == 0 && poh.DocumentStatus < 99) { sfd.FileName = poh.DocumentID + "-Temp-" + poh.TemporaryNo; } else { sfd.FileName = poh.DocumentID + "-" + poh.PONo; } ///sfd.FileName = poh.DocumentID + "-" + poh.PONo; if (sfd.ShowDialog() == DialogResult.Cancel || sfd.FileName == "") { return; } FileStream fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write); Rectangle rec = new Rectangle(PageSize.A4); iTextSharp.text.Document doc = new iTextSharp.text.Document(rec); PdfWriter writer = PdfWriter.GetInstance(doc, fs); MyEvent evnt = new MyEvent(); writer.PageEvent = evnt; doc.Open(); Font font1 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); Font font2 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK); Font font3 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.ITALIC, BaseColor.BLACK); Font font4 = FontFactory.GetFont("Arial", 5, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); String URL = "Cellcomm2.JPG"; iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(URL); img.Alignment = Element.ALIGN_LEFT; PdfPTable tableHeader = new PdfPTable(2); tableHeader.WidthPercentage = 100; PdfPCell cellImg = new PdfPCell(); Paragraph pp = new Paragraph(); pp.Add(new Chunk(img, 0, 0)); cellImg.AddElement(pp); cellImg.Border = 0; tableHeader.AddCell(cellImg); PdfPCell cellAdd = new PdfPCell(); Paragraph ourAddr = new Paragraph(""); CompanyDetailDB compDB = new CompanyDetailDB(); cmpnydetails det = compDB.getdetails().FirstOrDefault(comp => comp.companyID == 1); if (det != null) { ourAddr.Add(new Chunk(det.companyname + "\n", font2)); ourAddr.Add(new Chunk(det.companyAddress.Replace("\r\n", "\n"), font4)); StringBuilder sb = new StringBuilder(); sb.Append("\nGST : " + companyInfo["GST"] + "\nState Code for GST : " + companyInfo["StateCode"] + "\nCIN : " + companyInfo["CIN"] + "\nPAN : " + companyInfo["PAN"]); ourAddr.Add(new Chunk(sb.ToString(), font4)); ourAddr.Alignment = Element.ALIGN_RIGHT; ourAddr.SetLeading(0.0f, 1.5f); } cellAdd.AddElement(ourAddr); cellAdd.Border = 0; tableHeader.AddCell(cellAdd); PdfPTable tableDocName = new PdfPTable(1); tableDocName.WidthPercentage = 100; PdfPCell cellHdr = new PdfPCell(new Phrase("PURCHASE ORDER", font2)); cellHdr.Border = 0; cellHdr.HorizontalAlignment = PdfPCell.ALIGN_CENTER; tableDocName.AddCell(cellHdr); if (poh.CountryID != null && poh.CountryID != "India") { PdfPCell cellHdrInr = new PdfPCell(new Phrase("(Import)", font2)); cellHdrInr.Border = 0; cellHdrInr.HorizontalAlignment = PdfPCell.ALIGN_CENTER; tableDocName.AddCell(cellHdrInr); } Paragraph paragraphOpenCluse = new Paragraph(new Phrase(declaration, font1)); paragraphOpenCluse.Alignment = Element.ALIGN_JUSTIFIED; paragraphOpenCluse.SpacingBefore = 10; PrintPurchaseOrder prog = new PrintPurchaseOrder(); string[] HeaderStr = HeaderString.Split(Main.delimiter2); PdfPTable TableAddress = new PdfPTable(7); TableAddress.SpacingBefore = 20f; TableAddress.WidthPercentage = 100; float[] HWidths = new float[] { 1f, 8f, 2f, 1.5f, 1.5f, 3f, 1.5f }; TableAddress.SetWidths(HWidths); PdfPCell cell; int[] arr = { 6, 7, 9, 10 }; float wid = 0; for (int i = 0; i < HeaderStr.Length; i++) { if (i == 0 || i == 5 || i == 10) { string[] format = HeaderStr[i].Split(Main.delimiter1); Phrase phr = new Phrase(); phr.Add(new Chunk(format[0], font2)); phr.Add(new Chunk(format[1], font1)); cell = new PdfPCell(phr); cell.Colspan = 2; cell.Rowspan = 4; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right TableAddress.AddCell(cell); } else { cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1)); cell.Colspan = 5; cell.MinimumHeight = wid; TableAddress.AddCell(cell); } } string[] ColHeaderStr = ColHeader.Split(';'); PdfPTable TableItemDetails = new PdfPTable(7); TableItemDetails.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.WidthPercentage = 100; float[] width = new float[] { 1f, 8f, 2f, 1.5f, 2f, 2.5f, 1.5f }; TableItemDetails.SetWidths(width); for (int i = 0; i < ColHeaderStr.Length; i++) { if (i == 4 || i == 5) { PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim() + "\n(" + poh.CurrencyID + ")", font2)); hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.AddCell(hcell); } else { PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim(), font2)); hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.AddCell(hcell); } } //--- PdfPCell foot = new PdfPCell(new Phrase("")); foot.Colspan = 7; foot.BorderWidthTop = 0; foot.MinimumHeight = 0.5f; TableItemDetails.AddCell(foot); TableItemDetails.HeaderRows = 2; TableItemDetails.FooterRows = 1; TableItemDetails.SkipFirstHeader = false; TableItemDetails.SkipLastFooter = true; //--- int track = 0; decimal dc1 = 0; decimal dc2 = 0; string[] DetailStr = ColDetailString.Split(Main.delimiter2); float hg = 0f; for (int i = 0; i < DetailStr.Length; i++) { track = 0; hg = TableItemDetails.GetRowHeight(i + 1); string[] str = DetailStr[i].Split(Main.delimiter1); for (int j = 0; j < str.Length; j++) { PdfPCell pcell; if (j == 2 || j == 4 || j == 5) { decimal p = 1; if (Decimal.TryParse(str[j], out p)) { pcell = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(str[j])), font1)); } else { pcell = new PdfPCell(new Phrase("")); } pcell.Border = 0; if (j == 5) { if (str[0].Length == 0) { pcell.BorderWidthBottom = 0.01f; track = 1; dc2 = Convert.ToDecimal(str[j]); } else { dc1 = Convert.ToDecimal(str[j]); } } } else { if (j == 6) { if ((str[j].Trim().Length == 0 || Convert.ToInt32(str[j]) == 0) && (track != 1)) { pcell = new PdfPCell(new Phrase("NA", font1)); } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else if (j == 3) { int m = 1; if (Int32.TryParse(str[j], out m) == true) { if (Convert.ToInt32(str[j]) == 0) { pcell = new PdfPCell(new Phrase("", font1)); } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } pcell.Border = 0; } pcell.MinimumHeight = 10; //pcell.MinimumHeight = 20; if (j == 1) { pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; } else { pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; } pcell.BorderWidthLeft = 0.01f; pcell.BorderWidthRight = 0.01f; TableItemDetails.AddCell(pcell); } } double roundedAmt = Math.Round(totAmnt, 0); double diffAmount = roundedAmt - totAmnt; if (diffAmount != 0) { TableItemDetails.AddCell(""); TableItemDetails.AddCell(""); PdfPCell cellTot = new PdfPCell(new Phrase("", font1)); cellTot.Colspan = 3; cellTot.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.AddCell(cellTot); TableItemDetails.AddCell(new Phrase(String.Format("{0:0.00}", totAmnt), font1)); TableItemDetails.AddCell(""); TableItemDetails.AddCell(""); TableItemDetails.AddCell(""); PdfPCell cellRound = new PdfPCell(new Phrase("Rounding off", font1)); cellRound.Colspan = 3; cellRound.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.AddCell(cellRound); TableItemDetails.AddCell(new Phrase(String.Format("{0:0.00}", diffAmount), font1)); TableItemDetails.AddCell(""); } TableItemDetails.AddCell(""); TableItemDetails.AddCell(""); PdfPCell cellTotal = new PdfPCell(new Phrase("Total", font1)); cellTotal.Colspan = 3; cellTotal.HorizontalAlignment = PdfPCell.ALIGN_CENTER; TableItemDetails.AddCell(cellTotal); TableItemDetails.AddCell(new Phrase(String.Format("{0:0.00}", roundedAmt), font1)); TableItemDetails.AddCell(""); string total = footer1 + NumberToString.convert(roundedAmt.ToString()).Replace("INR", poh.CurrencyID) + "\n\n"; PdfPCell fcell1 = new PdfPCell(new Phrase((total), font1)); fcell1.Colspan = 6; fcell1.MinimumHeight = 50; fcell1.HorizontalAlignment = PdfPCell.ALIGN_LEFT; fcell1.BorderWidthRight = 0; fcell1.BorderWidthTop = 0; TableItemDetails.AddCell(fcell1); PdfPCell fcell4 = new PdfPCell(new Phrase("E. & O.E", font1)); fcell4.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; fcell4.BorderWidthLeft = 0; fcell4.BorderWidthTop = 0; TableItemDetails.AddCell(fcell4); PdfPTable tableSub = new PdfPTable(1); tableSub.DefaultCell.Border = 0; tableSub.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; tableSub.AddCell(new Phrase("Subject To Bangalore Jurisdiction", font2)); PdfPCell celSub = new PdfPCell(tableSub); celSub.Border = 0; celSub.Colspan = 7; TableItemDetails.AddCell(celSub); TableItemDetails.KeepRowsTogether(TableItemDetails.Rows.Count - 6, TableItemDetails.Rows.Count); Paragraph footer = new Paragraph(new Phrase("Note : " + footer2, font3)); footer.Alignment = Element.ALIGN_LEFT; PdfPTable TCTab = new PdfPTable(2); if (poh.TermsAndCondition.Trim().Length != 0) { Chunk TCchunk = new Chunk("General Terms & Conditions\n", font2); TCchunk.SetUnderline(0.2f, -2f); TCTab = new PdfPTable(2); TCTab.WidthPercentage = 100; PdfPCell TCCell = new PdfPCell(); TCCell.Colspan = 2; TCCell.Border = 0; TCCell.AddElement(TCchunk); TCTab.AddCell(TCCell); try { string[] ParaTC = termsAndCond.Split(Main.delimiter2); for (int i = 0; i < ParaTC.Length - 1; i++) { TCCell = new PdfPCell(); TCCell.Colspan = 2; TCCell.Border = 0; Paragraph header = new Paragraph(); Paragraph details = new Paragraph(); details.IndentationLeft = 12f; details.IndentationRight = 12f; details.Alignment = Element.ALIGN_JUSTIFIED; string paraHeaderStr = (i + 1) + ". " + ParaTC[i].Substring(0, ParaTC[i].IndexOf(Main.delimiter1)) + ":"; string paraFooterStr = ParaTC[i].Substring(ParaTC[i].IndexOf(Main.delimiter1) + 1); header.Add(new Phrase(paraHeaderStr, font2)); details.Add(new Phrase(paraFooterStr, font1)); TCCell.AddElement(header); TCCell.AddElement(details); TCTab.AddCell(TCCell); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString()); } try { if (TCTab.Rows.Count >= 3) { TCTab.KeepRowsTogether(0, 3); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString()); } } doc.Add(tableHeader); doc.Add(tableDocName); doc.Add(paragraphOpenCluse); doc.Add(TableAddress); doc.Add(TableItemDetails); doc.Add(footer); if (poh.TermsAndCondition.Trim().Length != 0) { doc.Add(TCTab); } doc.Close(); if (poh.Status == 0 && poh.DocumentStatus < 99) { String wmurl = ""; wmurl = "004.png"; PrintWaterMark.PdfStampWithNewFile(wmurl, sfd.FileName); } MessageBox.Show("Document Saved"); } catch (Exception ex) { MessageBox.Show("Failed to Save Document"); } }
public void PrintPO(poheader poh, List <podetail> PODetail, string taxStr) { Dictionary <string, string> companyInfo = getCompanyInformation(); //string stateDetail = customer custDetail = CustomerDB.getCustomerDetailForPO(poh.CustomerID); string[] companyBillingAdd = CompanyAddressDB.getCompTopBillingAdd(Login.companyID); string poNoSuffix = ""; if (poh.DocumentID == "POGENERAL") { poNoSuffix = "G-"; } else if (poh.DocumentID == "PURCHASEORDER") { poNoSuffix = "P-"; } string supplAdd = "Supplier:\n" + custDetail.name + Main.delimiter1 + "\n" + custDetail.BillingAddress + "\n"; if (custDetail.StateName.ToString().Length != 0) { supplAdd = supplAdd + "Sate Name:" + custDetail.StateName; } if (custDetail.StateCode.ToString().Length != 0) { supplAdd = supplAdd + "\nState Code:" + custDetail.StateCode; } if (custDetail.OfficeName.ToString().Length != 0) { supplAdd = supplAdd + "\nGST:" + custDetail.OfficeName; // For GST Code } //; : main.delimiter2 //$ : main.delimiter1 string InvoiceTo = "Invoice To: \n" + companyBillingAdd[0] + Main.delimiter1 + "\n" + companyBillingAdd[1] + "\nGST:" + companyInfo["GST"] + "\nCIN:" + companyInfo["CIN"] + "\nPAN:" + companyInfo["PAN"]; string DespatchTo = "Dispatch To:\n" + companyBillingAdd[0] + Main.delimiter1 + "\n" + poh.DeliveryAddress + "\nGST:" + companyInfo["GST"]; string HeaderString = supplAdd + Main.delimiter2 + "PO No : " + poNoSuffix + poh.PONo + Main.delimiter2 + "Date: " + poh.PODate.ToString("dd-MM-yyyy") + Main.delimiter2 + "Supplier Ref./Order No.\n" + poh.ReferenceQuotation.Replace(";", ",\n") + Main.delimiter2 + "Despatch Through:\n" + CatalogueValueDB.getParamValue("TransportationMode", poh.TransportationMode) + Main.delimiter2 + InvoiceTo + Main.delimiter2 + "Freight:\n" + CatalogueValueDB.getParamValue("Freight", poh.FreightTerms) + Main.delimiter2 + "Delivery Period:\n" + poh.DeliveryPeriod + " Days" + Main.delimiter2 + DespatchTo + Main.delimiter2 + "Tax And Duties:\n" + CatalogueValueDB.getParamValue("TaxStatus", poh.TaxTerms) + Main.delimiter2 + "Mode/Terms of Payment:\n" + CatalogueValueDB.getParamValue("PaymentMode", poh.ModeOfPayment) + "\n" + PTDefinitionDB.getPaymentTermString(poh.PaymentTerms); string footer1 = "Amount In Words\n\n"; string ColHeader = "SI No.;Description of Goods;Quantity;Unit;Unit Rate;Amount;Warranty\nIn Days"; string footer2 = ""; string footer3 = "for CELLCOMM SOLUTION LIMITED;Authorised Signatory"; string termsAndCond = getTCString(poh.TermsAndCondition); double totQuant = 0.00; double totAmnt = 0.00; int n = 1; string ColDetailString = ""; var count = PODetail.Count(); foreach (podetail pod in PODetail) { if (n == count) { //ColDetailString = ColDetailString + n + "+" + pod.Description + "+" + pod.Quantity + "+" // + pod.Unit + "+" + pod.Price + "+" + (pod.Quantity * pod.Price) + "+" + pod.WarrantyDays; ColDetailString = ColDetailString + n + Main.delimiter1 + pod.Description + Main.delimiter1 + pod.Quantity + Main.delimiter1 + pod.Unit + Main.delimiter1 + pod.Price + Main.delimiter1 + (pod.Quantity * pod.Price) + Main.delimiter1 + pod.WarrantyDays; if (pod.Tax != 0) { //ColDetailString = ColDetailString + ";" +"" + "+" + pod.TaxCode + "+" + "" + "+" // + "" + "+" + "" + "+" + pod.Tax + "+" + ""; ColDetailString = ColDetailString + Main.delimiter2 + "" + Main.delimiter1 + pod.TaxCode + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + pod.Tax + Main.delimiter1 + ""; } // ColDetailString = ColDetailString } else { //ColDetailString = ColDetailString + n + "+" + pod.Description + "+" + pod.Quantity + "+" // + pod.Unit + "+" + pod.Price + "+" + (pod.Quantity * pod.Price) + "+" + pod.WarrantyDays + ";"; ColDetailString = ColDetailString + n + Main.delimiter1 + pod.Description + Main.delimiter1 + pod.Quantity + Main.delimiter1 + pod.Unit + Main.delimiter1 + pod.Price + Main.delimiter1 + (pod.Quantity * pod.Price) + Main.delimiter1 + pod.WarrantyDays + Main.delimiter2; if (pod.Tax != 0) { //ColDetailString = ColDetailString + "" + "+" + pod.TaxCode + "+" + "" + "+" // + "" + "+" + "" + "+" + pod.Tax + "+" + "" + Main.delimiter2; ColDetailString = ColDetailString + "" + Main.delimiter1 + pod.TaxCode + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + pod.Tax + Main.delimiter1 + "" + Main.delimiter2; } } totQuant = totQuant + pod.Quantity; totAmnt = totAmnt + (pod.Quantity * pod.Price); n++; } try { SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save As PDF"; sfd.Filter = "Pdf files (*.Pdf)|*.pdf"; sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); sfd.FileName = poh.DocumentID + "-" + poh.PONo; if (sfd.ShowDialog() == DialogResult.Cancel || sfd.FileName == "") { return; } FileStream fs = new FileStream(sfd.FileName + ".pdf", FileMode.Create, FileAccess.Write); Rectangle rec = new Rectangle(PageSize.A4); iTextSharp.text.Document doc = new iTextSharp.text.Document(rec); PdfWriter writer = PdfWriter.GetInstance(doc, fs); MyEvent evnt = new MyEvent(); writer.PageEvent = evnt; doc.Open(); Font font1 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); Font font2 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK); Font font3 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.ITALIC, BaseColor.BLACK); String URL = "Cellcomm2.JPG"; iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(URL); img.Alignment = Element.ALIGN_LEFT; PdfPTable tableMain = new PdfPTable(2); tableMain.WidthPercentage = 100; PdfPCell cellImg = new PdfPCell(); Paragraph pp = new Paragraph(); pp.Add(new Chunk(img, 0, 0)); cellImg.AddElement(pp); cellImg.Border = 0; tableMain.AddCell(cellImg); PdfPCell cellAdd = new PdfPCell(); Paragraph ourAddr = new Paragraph(""); CompanyDetailDB compDB = new CompanyDetailDB(); cmpnydetails det = compDB.getdetails().FirstOrDefault(comp => comp.companyID == 1); if (det != null) { string addr = det.companyname + "\n" + det.companyAddress; ourAddr = new Paragraph(new Phrase(addr, font2)); ourAddr.Alignment = Element.ALIGN_RIGHT; } cellAdd.AddElement(ourAddr); cellAdd.Border = 0; tableMain.AddCell(cellAdd); Paragraph paragraph = new Paragraph(new Phrase("PURCHASE ORDER", font2)); paragraph.Alignment = Element.ALIGN_CENTER; PrintPurchaseOrder prog = new PrintPurchaseOrder(); string[] HeaderStr = HeaderString.Split(Main.delimiter2); PdfPTable table = new PdfPTable(7); table.SpacingBefore = 20f; table.WidthPercentage = 100; float[] HWidths = new float[] { 0.5f, 8f, 2f, 1.5f, 1.5f, 3f, 1.5f }; table.SetWidths(HWidths); PdfPCell cell; int[] arr = { 6, 7, 9, 10 }; float wid = 0; for (int i = 0; i < HeaderStr.Length; i++) { if (i == 0 || i == 5 || i == 8) { string[] format = HeaderStr[i].Split(Main.delimiter1); Phrase phr = new Phrase(); phr.Add(new Chunk(format[0], font2)); phr.Add(new Chunk(format[1], font1)); //cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1)); cell = new PdfPCell(phr); cell.Rowspan = 2; cell.Colspan = 2; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //wid = cell.MinimumHeight / 2; table.AddCell(cell); } else if (arr.Contains(i)) { cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1)); cell.Colspan = 5; cell.MinimumHeight = wid; table.AddCell(cell); } else { cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1)); if (i % 2 != 0) { cell.Colspan = 3; } else { cell.Colspan = 2; } table.AddCell(cell); } } string[] ColHeaderStr = ColHeader.Split(';'); PdfPTable table1 = new PdfPTable(7); table1.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table1.WidthPercentage = 100; float[] width = new float[] { 0.5f, 8f, 2f, 1.5f, 2f, 2.5f, 1.5f }; table1.SetWidths(width); for (int i = 0; i < ColHeaderStr.Length; i++) { if (i == 4 || i == 5) { PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim() + "\n(" + poh.CurrencyID + ")", font2)); hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table1.AddCell(hcell); } else { PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim(), font2)); hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table1.AddCell(hcell); } } //--- PdfPCell foot = new PdfPCell(new Phrase("")); foot.Colspan = 7; foot.BorderWidthTop = 0; foot.MinimumHeight = 0.5f; table1.AddCell(foot); table1.HeaderRows = 2; table1.FooterRows = 1; table1.SkipFirstHeader = false; table1.SkipLastFooter = true; //--- int track = 0; decimal dc1 = 0; decimal dc2 = 0; string[] DetailStr = ColDetailString.Split(Main.delimiter2); float hg = 0f; for (int i = 0; i < DetailStr.Length; i++) { track = 0; hg = table1.GetRowHeight(i + 1); string[] str = DetailStr[i].Split(Main.delimiter1); for (int j = 0; j < str.Length; j++) { PdfPCell pcell; if (j == 2 || j == 4 || j == 5) { decimal p = 1; if (Decimal.TryParse(str[j], out p)) { pcell = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(str[j])), font1)); } else { pcell = new PdfPCell(new Phrase("")); } pcell.Border = 0; if (j == 5) { if (str[0].Length == 0) { pcell.BorderWidthBottom = 0.01f; track = 1; dc2 = Convert.ToDecimal(str[j]); } else { dc1 = Convert.ToDecimal(str[j]); } } } else { if (j == 6) { if ((str[j].Trim().Length == 0 || Convert.ToInt32(str[j]) == 0) && (track != 1)) { pcell = new PdfPCell(new Phrase("NA", font1)); } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else if (j == 3) { int m = 1; if (Int32.TryParse(str[j], out m) == true) { if (Convert.ToInt32(str[j]) == 0) { pcell = new PdfPCell(new Phrase("", font1)); } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } } else { pcell = new PdfPCell(new Phrase(str[j], font1)); } pcell.Border = 0; } //if (i == DetailStr.Length - 1) //{ // pcell.MinimumHeight = 50; //} //else pcell.MinimumHeight = 10; //pcell.MinimumHeight = 20; if (j == 1) { pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; } else { pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; } pcell.BorderWidthLeft = 0.01f; pcell.BorderWidthRight = 0.01f; table1.AddCell(pcell); } //foreach() if (track == 1) { for (int j = 0; j < 7; j++) { PdfPCell pcell1; if (j == 5) { pcell1 = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(dc1 + dc2)), font1)); pcell1.Border = 0; pcell1.BorderWidthBottom = 0.01f; } else { pcell1 = new PdfPCell(new Phrase("")); pcell1.Border = 0; } pcell1.HorizontalAlignment = PdfPCell.ALIGN_CENTER; pcell1.BorderWidthLeft = 0.01f; pcell1.BorderWidthRight = 0.01f; table1.AddCell(pcell1); } } } double roundedAmt = Math.Round(poh.POValue, 0); double diffAmount = roundedAmt - poh.POValue; if (diffAmount != 0) { table1.AddCell(""); table1.AddCell(""); PdfPCell cellRound = new PdfPCell(new Phrase("Round off Adj.", font1)); cellRound.Colspan = 3; cellRound.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table1.AddCell(cellRound); table1.AddCell(new Phrase(String.Format("{0:0.00}", diffAmount), font1)); table1.AddCell(""); } table1.AddCell(""); table1.AddCell(""); PdfPCell cellTotal = new PdfPCell(new Phrase("Total", font1)); cellTotal.Colspan = 3; cellTotal.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table1.AddCell(cellTotal); table1.AddCell(new Phrase(String.Format("{0:0.00}", roundedAmt), font1)); table1.AddCell(""); string total = footer1 + NumberToString.convert(roundedAmt.ToString()).Replace("INR", poh.CurrencyID) + "\n\n"; PdfPCell fcell1 = new PdfPCell(new Phrase((total), font1)); fcell1.Colspan = 6; fcell1.MinimumHeight = 50; fcell1.HorizontalAlignment = PdfPCell.ALIGN_LEFT; fcell1.BorderWidthBottom = 0; fcell1.BorderWidthRight = 0; fcell1.BorderWidthTop = 0; table1.AddCell(fcell1); PdfPCell fcell4 = new PdfPCell(new Phrase("E. & O.E", font1)); //fcell4.MinimumHeight = 50; fcell4.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; fcell4.BorderWidthBottom = 0; //fcell4.BorderWidthRight = 0; fcell4.BorderWidthLeft = 0; fcell4.BorderWidthTop = 0; table1.AddCell(fcell4); if (poh.SpecialNote.Trim().Length != 0) { footer2 = "Note:\n" + poh.SpecialNote.Trim(); } PdfPCell fcell2 = new PdfPCell(new Phrase(footer2, font1)); fcell2.Colspan = 4; fcell2.HorizontalAlignment = PdfPCell.ALIGN_LEFT; fcell2.BorderWidthTop = 0; fcell2.BorderWidthRight = 0; table1.AddCell(fcell2); string[] ft = footer3.Split(';'); PdfPCell fcell3 = new PdfPCell(); Chunk ch1 = new Chunk(ft[0], font1); Chunk ch2 = new Chunk(ft[1], font1); Phrase phrase = new Phrase(); phrase.Add(ch1); for (int i = 0; i < 3; i++) { phrase.Add(Chunk.NEWLINE); } phrase.Add(ch2); Paragraph para = new Paragraph(); para.Add(phrase); para.Alignment = Element.ALIGN_RIGHT; fcell3.AddElement(para); fcell3.Border = 0; fcell3.Colspan = 4; fcell3.BorderWidthTop = 0f; fcell3.BorderWidthLeft = 0f; fcell3.BorderWidthRight = 0.5f; fcell3.BorderWidthBottom = 0.5f; fcell3.MinimumHeight = 50; table1.AddCell(fcell3); table1.KeepRowsTogether(table1.Rows.Count - 4, table1.Rows.Count); PdfPTable taxTab = new PdfPTable(3); //taxTab. taxTab.WidthPercentage = 100; float[] twidth = new float[] { 3f, 3f, 10f }; taxTab.SetWidths(twidth); double dd = 0; if (poh.TaxAmount != 0) { PdfPCell pcell; pcell = new PdfPCell(new Phrase("Tax Details", font2)); taxTab.AddCell(pcell); PdfPCell pcellc = new PdfPCell(new Phrase("Amount(" + poh.CurrencyID + ")", font2)); taxTab.AddCell(pcellc); PdfPCell pcelllst = new PdfPCell(new Phrase("", font1)); pcelllst.Border = 0; taxTab.AddCell(pcelllst); //for (int i = 0; i < 2; i++) //{ // if (i == 1) // pcell = new PdfPCell(new Phrase("Tax Details", font2)); // else // //pcell.Border = 0; // //pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; // //pcell.MinimumHeight = 20; // //pcell.BorderWidthLeft = 0.01f; // //pcell.BorderWidthRight = 0.01f; // table1.AddCell(pcell); //} string[] tax = taxStr.Split(Main.delimiter2); for (int i = 0; i < tax.Length - 1; i++) { string[] subtax = tax[i].Split(Main.delimiter1); PdfPCell pcell1; pcell1 = new PdfPCell(new Phrase(subtax[0], font1)); PdfPCell pcell2; pcell2 = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(subtax[1])), font1)); PdfPCell pcell3 = new PdfPCell(new Phrase("", font1)); pcell3.Border = 0; //taxTab.AddCell(pcell3); //pcell1.Border = 0; //pcell1.HorizontalAlignment = PdfPCell.ALIGN_CENTER; //pcell1.BorderWidthLeft = 0.01f; //pcell1.BorderWidthRight = 0.01f; //if (i == (tax.Length - 2)) //{ // pcell1.MinimumHeight = 100; //} //else //pcell1.MinimumHeight = 20; taxTab.AddCell(pcell1); //pcell2.MinimumHeight = 20; taxTab.AddCell(pcell2); taxTab.AddCell(pcell3); } taxTab.AddCell(new Phrase("Total Tax Amount", font2)); taxTab.AddCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(poh.TaxAmount)), font2)); PdfPCell pcellt = new PdfPCell(new Phrase("", font1)); pcellt.Border = 0; taxTab.AddCell(pcellt); taxTab.KeepTogether = true; taxTab.SpacingAfter = 2f; taxTab.SpacingBefore = 3f; } PdfPTable TCTab = new PdfPTable(2); if (poh.TermsAndCondition.Trim().Length != 0) { Chunk TCchunk = new Chunk("Terms And Conditoins:\n", font2); TCchunk.SetUnderline(0.2f, -2f); TCTab = new PdfPTable(2); TCTab.WidthPercentage = 100; PdfPCell TCCell = new PdfPCell(); TCCell.Colspan = 2; TCCell.Border = 0; TCCell.AddElement(TCchunk); TCTab.AddCell(TCCell); try { string[] ParaTC = termsAndCond.Split(Main.delimiter2); for (int i = 0; i < ParaTC.Length - 1; i++) { TCCell = new PdfPCell(); TCCell.Colspan = 2; TCCell.Border = 0; Paragraph header = new Paragraph(); Paragraph details = new Paragraph(); details.IndentationLeft = 12f; details.IndentationRight = 12f; string paraHeaderStr = (i + 1) + ". " + ParaTC[i].Substring(0, ParaTC[i].IndexOf(Main.delimiter1)) + ":"; string paraFooterStr = ParaTC[i].Substring(ParaTC[i].IndexOf(Main.delimiter1) + 1); header.Add(new Phrase(paraHeaderStr, font2)); details.Add(new Phrase(paraFooterStr, font1)); TCCell.AddElement(header); TCCell.AddElement(details); TCTab.AddCell(TCCell); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString()); } try { if (TCTab.Rows.Count >= 3) { TCTab.KeepRowsTogether(0, 3); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString()); } } doc.Add(tableMain); //doc.Add(jpg); //doc.Add(img); doc.Add(paragraph); doc.Add(table); doc.Add(table1); if (poh.TaxAmount != 0) { doc.Add(taxTab); } if (poh.TermsAndCondition.Trim().Length != 0) { doc.Add(TCTab); } doc.Close(); MessageBox.Show("Document Saved"); } catch (Exception ex) { MessageBox.Show("Failed to Save Document"); } }
private void initVariables() { StockGroupDB.fillGroupValueCombo(cmbGroup1, 1); CatalogueValueDB.fillCatalogValueComboNew(cmbUnit, "StockUnit"); fillStatusCombo(cmbStatus); }
private void initVariables() { cmbStatus.SelectedIndex = 0; CatalogueValueDB.fillCatalogValueComboNew(cmbServiceItemID, "ServiceLookup"); }
private void ListEmployee() { try { grdList.Visible = true; grdList.Rows.Clear(); AttendanceDB dbrecord = new AttendanceDB(); List <attendance> emplist = new List <attendance>(); List <attendance> empleavelist = new List <attendance>(); List <attendance> empbiolist = new List <attendance>(); List <attendance> empMRlist = new List <attendance>(); int opt = 0; empstatuslist = new List <attendance>(); if (Main.itemPriv[2]) { if (cmbfilterOffice.SelectedIndex != -1) { string officeid = ((Structures.ComboBoxItem)cmbfilterOffice.SelectedItem).HiddenValue; emplist = dbrecord.getEmployeeListforoffice(officeid).OrderBy(x => x.EmployeeName).ToList(); if (dtpdate.Value.Date <= UpdateTable.getSQLDateTime().Date) { empstatuslist = dbrecord.getEmployeestatusListforoffice(officeid, dtpdate.Value); if (empstatuslist.Count == 0) { empleavelist = dbrecord.getEmployeeLeaveList(dtpdate.Value); empbiolist = dbrecord.getEmployeeBiometricList(dtpdate.Value); empMRlist = dbrecord.getMrEmployeeList(dtpdate.Value); } } else if (dtpdate.Value.Date > UpdateTable.getSQLDateTime().Date) { pnlEditButtons.Visible = false; MessageBox.Show("Please select the date equal to or less than today!!!"); return; } } } else { emplist = dbrecord.getEmployeeList().OrderBy(x => x.EmployeeName).ToList(); empstatuslist = dbrecord.getEmployeestatusListforoffice(emplOfficeID, UpdateTable.getSQLDateTime()); if (empstatuslist.Count == 0) { empleavelist = dbrecord.getEmployeeLeaveList(UpdateTable.getSQLDateTime()); empbiolist = dbrecord.getEmployeeBiometricList(UpdateTable.getSQLDateTime()); empMRlist = dbrecord.getMrEmployeeList(UpdateTable.getSQLDateTime()); } } foreach (attendance elst in emplist) { grdList.Rows.Add(); int kount = grdList.RowCount; grdList.Rows[kount - 1].Cells["RowID"].Value = kount; grdList.Rows[kount - 1].Cells["EmployeeID"].Value = Convert.ToInt32(elst.EmployeeID); grdList.Rows[kount - 1].Cells["EmployeeName"].Value = elst.EmployeeName; DataGridViewComboBoxCell cmbAttendanceStatus = (DataGridViewComboBoxCell)(grdList.Rows[kount - 1].Cells["AttendanceStatus"]); CatalogueValueDB.fillCatalogValueGridViewComboNew(cmbAttendanceStatus, "AttendanceStatus"); attendance empstatlst = empstatuslist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); if (empstatlst == null) { attendance emplvlst = empleavelist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); attendance empbiolst = empbiolist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); attendance empMRlst = empMRlist.FirstOrDefault(x => x.EmployeeID == elst.EmployeeID); if (emplvlst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "Leave"; Initval.Add(emplvlst.EmployeeID, "Leave"); changedval.Add(emplvlst.EmployeeID, "Leave"); } else { if (empbiolst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "Present"; Initval.Add(empbiolst.EmployeeID, "Present"); changedval.Add(empbiolst.EmployeeID, "Present"); } else if (empMRlst != null) { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = "LocalTravel"; Initval.Add(empMRlst.EmployeeID, "LocalTravel"); changedval.Add(empMRlst.EmployeeID, "LocalTravel"); } } } else { grdList.Rows[kount - 1].Cells["AttendanceStatus"].Value = empstatlst.AttendenceStatus; Initval.Add(empstatlst.EmployeeID, empstatlst.AttendenceStatus); } } pnlEditButtons.Visible = false; if (!Main.itemPriv[2]) { if (grdList.RowCount > 0 && UpdateTable.getSQLDateTime().Hour < 13) { pnlEditButtons.Visible = true; } } else if (grdList.RowCount > 0) { pnlEditButtons.Visible = true; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } enableBottomButtons(); pnlMenuList.Visible = true; }