Esempio n. 1
0
        private void writeToBidLog(string path)
        {
            if (!IsFileLocked(path))
            {
                var wb = new XLWorkbook(path);
                var ws = wb.Worksheet("Bid Log");

                var nextRow = ws.Row(10);
                while (nextRow.Cell(1).Value.ToString() != "" &&
                       (string)nextRow.Cell(2).Value.ToString() != "")
                {
                    nextRow = nextRow.RowBelow();
                }
                nextRow.Cell(1).Value  = BidNumber;
                nextRow.Cell(2).Value  = ProjectName;
                nextRow.Cell(3).Value  = Location;
                nextRow.Cell(4).Value  = Client;
                nextRow.Cell(5).Value  = Salesperson;
                nextRow.Cell(6).Value  = Estimator;
                nextRow.Cell(7).Value  = DueDate.ToShortDateString();
                nextRow.Cell(11).Value = RequiresScope ? "Yes" : "No";
                nextRow.Cell(12).Value = TechnicalRequired ? "Yes" : "No";

                wb.Save();
            }
            else
            {
                MessageBox.Show("Bid log is open elsewhere. Please close and try again.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Format this task to be displayed to the console.
        /// I had to make this because Console.WriteLine doesn't like when you give it a dynamic width for the columns
        /// </summary>
        /// <param name="tab1">The length of the name column</param>
        /// <param name="tab2">The length of the due date column</param>
        /// <param name="tab3">The length of the completion status column</param>
        /// <param name="tab4">The length of the description column</param>
        /// <returns>The formatted string for display</returns>
        public string FormatForDisplay(int tab1, int tab2, int tab3, int tab4)
        {
            string complete = (_complete ? "Complete" : "Incomplete");

            return(new string(' ', tab1 - _name.Length) + _name
                   + new string(' ', tab2 - DueDate.ToShortDateString().Length) + DueDate.ToShortDateString()
                   + new string(' ', tab3 - complete.Length) + complete
                   + new string(' ', tab4 - _desc.Length) + _desc);
        }
Esempio n. 3
0
        /*Виртуальный метод возврата строки для таблицы*/
        protected internal virtual ListViewItem GetListViewItem()
        {
            var item = new ListViewItem(BarCode);

            item.SubItems.Add(DueDate.ToShortDateString());
            item.SubItems.Add(Organization);
            item.SubItems.Add(Name);
            item.SubItems.Add(Count.ToString());
            item.SubItems.Add(Cost.ToString());
            item.SubItems.Add(GetStatusString());
            item.SubItems.Add(Note);
            return(item);
        }
Esempio n. 4
0
 public bool Equals(Ticket other)
 {
     return
         (other.Status.TicketStatusId == Status.TicketStatusId &&
          other.Requestor.RequestorId == Requestor.RequestorId &&
          other.Queue.QueueId == Queue.QueueId &&
          other.Priority == Priority &&
          other.Module.TicketModuleId == Module.TicketModuleId &&
          other.DueDate.ToShortDateString() == DueDate.ToShortDateString() &&
          other.Description == Description &&
          other.Creator == Creator &&
          other.CreationDate.ToShortDateString() == CreationDate.ToShortDateString() &&
          other.Category.TicketCategoryId == Category.TicketCategoryId);
 }
Esempio n. 5
0
        private void writeToProposalOpening()
        {
            Dictionary <string, string> fields = new Dictionary <string, string>();

            fields["<Bid Number>"]   = BidNumber;
            fields["<Project Name>"] = ProjectName;
            fields["<Location>"]     = Location;
            fields["<Salesperson>"]  = Salesperson;
            fields["<Estimator>"]    = Estimator;
            fields["<DateReceived>"] = ReceivedDate.ToShortDateString();
            fields["<DateDue>"]      = DueDate.ToShortDateString();
            fields["<RequestedBy>"]  = RequestedBy;


            using (WordprocessingDocument doc =
                       WordprocessingDocument.Open(BidFolder + @"\Proposal Opening Form.docx", true))
            {
                var   body  = doc.MainDocumentPart.Document.Body;
                Table table = body.Elements <Table>().First();
                foreach (TableRow row in table.Elements <TableRow>())
                {
                    foreach (TableCell cell in row.Elements <TableCell>())
                    {
                        foreach (var para in cell.Elements <Paragraph>())
                        {
                            foreach (var run in para.Elements <Run>())
                            {
                                foreach (var text in run.Elements <Text>())
                                {
                                    foreach (string key in fields.Keys)
                                    {
                                        if (text.Text.Contains(key))
                                        {
                                            text.Text = text.Text.Replace(key, fields[key]);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 public override string ToString()
 {
     return(DueDate.ToShortDateString() + " - " + Amount.ToString("F2", CultureInfo.InvariantCulture));
 }
Esempio n. 7
0
 public override string ToString()
 {
     return(DueDate.ToShortDateString() + ": " + Name + " for $" + Amount.ToString());
 }
Esempio n. 8
0
 public override string ToString()
 {
     return($"{DueDate.ToShortDateString()} - {Amount:C}");
 }
Esempio n. 9
0
 //Used to save information to file
 public string ToFileFomat()
 {
     return(string.Format("{0},{1},{2},{3}", TaskTitle, DueDate.ToShortDateString(), TypeOfCategory, Priority));
 }
Esempio n. 10
0
 //Used to convert data to comma separated format
 public string ToString(string delimiter)
 {
     return(TaskTitle + "," + DueDate.ToShortDateString() + "," + TypeOfCategory + "," + Priority);
 }
Esempio n. 11
0
 public override string ToString()
 {
     return($"Invoice No {Number} {TotalAmount:C2} {Customer.FullName} paid before {DueDate.ToShortDateString()}");
 }
Esempio n. 12
0
 public override string ToString()
 {
     return(DueDate.ToShortDateString() + " - " + Amount);
 }
Esempio n. 13
0
 //returns the data in the toodo item in a single line
 public string DataDump()
 {
     return("Task: " + Title + "     Priority: " + Priority + "     Due Date: " + DueDate.ToShortDateString() + "\n");
 }
Esempio n. 14
0
 public override string ToString()
 {
     return($"{DueDate.ToShortDateString()} - {Amount.ToString("F2", CultureInfo.InvariantCulture)}");
 }
Esempio n. 15
0
        protected override void Top(Section section)
        {
            Table table = section.AddTable();

            table.Borders.Visible = false;

            table.AddColumn(GetWidth(section) * 0.6);
            table.AddColumn(GetWidth(section) * 0.2);
            table.AddColumn(GetWidth(section) * 0.2);

            Row row = table.AddRow();

            row.Cells[0].AddParagraph(Company.Name); // logo?
            row.Cells[0].Style = "CompanyName";
            row.Cells[1].AddParagraph("LASKU");
            row.Cells[1].Style = "InvoiceTitle";

            Row companyRow = table.AddRow();

            row = table.AddRow();
            row.Cells[1].AddParagraph("Päivämäärä");
            row.Cells[2].AddParagraph(Date.ToShortDateString());

            row = table.AddRow();
            row.Cells[1].AddParagraph("Laskunumero");
            row.Cells[2].AddParagraph(Invoice.InvoiceID.ToString());

            companyRow.Cells[0].MergeDown = 3;
            if (Company.ContactPerson != null)
            {
                companyRow.Cells[0].AddParagraph(Company.ContactPerson);
            }
            companyRow.Cells[0].AddParagraph(Company.Address);
            companyRow.Cells[0].AddParagraph(Company.PostalCode + " " + Company.City);

            row = table.AddRow();
            row.Cells[1].AddParagraph("Viitenumero");
            row.Cells[2].AddParagraph(Invoice.Reference);

            row = table.AddRow();
            row.Cells[1].AddParagraph("Maksuehto");
            row.Cells[2].AddParagraph($"{Expire} pv netto");

            Row customerRow = table.AddRow();

            customerRow.Cells[1].AddParagraph("Eräpäivä");
            customerRow.Cells[2].AddParagraph(DueDate.ToShortDateString());

            row = table.AddRow();
            row.Cells[1].AddParagraph("Huomautusaika");
            row.Cells[2].AddParagraph($"{Invoice.AnnotationTime.ToString()} vrk");

            row = table.AddRow();
            row.Cells[1].AddParagraph("Viivästyskorko");
            row.Cells[2].AddParagraph($"{Invoice.Interest.ToString()} %");

            row = table.AddRow();

            customerRow.Cells[0].MergeDown = 3;
            customerRow.Cells[0].AddParagraph(Invoice.Customer.Name);
            if (Invoice.Customer.ContactPerson != null)
            {
                customerRow.Cells[0].AddParagraph(Invoice.Customer.ContactPerson);
            }
            customerRow.Cells[0].AddParagraph(Invoice.Customer.Address);
            customerRow.Cells[0].AddParagraph(Invoice.Customer.PostalCode + " " + Invoice.Customer.City + (Invoice.Customer.Country != null ?  " / " + Invoice.Customer.Country : null));

            section.AddParagraph();
        }
Esempio n. 16
0
        protected override void Bottom(Section section)
        {
            var textFrame = section.AddTextFrame();

            textFrame.RelativeVertical = RelativeVertical.Page;
            textFrame.Top = ShapePosition.Bottom;
            //textFrame.Width = section.PageSetup.PageWidth;
            //textFrame.Height = "5.5cm";

            Table table = textFrame.AddTable();

            table.Borders.Visible = false;

            table.AddColumn(GetWidth(section) * 0.2);
            table.AddColumn(GetWidth(section) * 0.3);
            table.AddColumn(GetWidth(section) * 0.24);
            table.AddColumn(GetWidth(section) * 0.1);
            table.AddColumn(GetWidth(section) * 0.16);

            Row row = table.AddRow();

            row.Height              = "0.5cm";
            row.Format.Alignment    = ParagraphAlignment.Right;
            row.Style               = "BottomTaxes";
            row.Cells[0].MergeRight = 3;
            row.Cells[0].AddParagraph("Arvonlisäveroton hinta");
            row.Cells[4].AddParagraph(TotalTaxless.ToString("C", System.Globalization.CultureInfo.CurrentCulture));

            row                     = table.AddRow();
            row.Height              = "0.5cm";
            row.Format.Alignment    = ParagraphAlignment.Right;
            row.Style               = "BottomTaxes";
            row.Cells[0].MergeRight = 3;
            row.Cells[0].AddParagraph("Arvonlisävero yhteensä");
            row.Cells[4].AddParagraph(TotalTax.ToString("C", System.Globalization.CultureInfo.CurrentCulture));

            row.Borders.Bottom.Style = BorderStyle.Single;;

            row       = table.AddRow();
            row.Style = "BottomHeader";
            row.Cells[0].AddParagraph("Eräpäivä");
            row.Cells[1].AddParagraph("Viitenumero");
            row.Height = "0.6cm";

            row.Cells[2].AddParagraph("Maksettava yhteensä");
            row.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[2].MergeRight       = 1;
            row.Cells[2].Style            = "BottomTotal";

            row.Cells[4].AddParagraph(TotalPrice.ToString("C", System.Globalization.CultureInfo.CurrentCulture));
            row.Cells[4].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[4].Style            = "BottomValue";

            row       = table.AddRow();
            row.Style = "Heading3";
            row.Cells[0].AddParagraph(DueDate.ToShortDateString());
            row.Cells[1].AddParagraph(Invoice.Reference);

            row.Borders.Bottom.Style = BorderStyle.Single;

            Row row1 = table.AddRow();

            row1.Style = "BottomHeader";
            row1.Cells[0].AddParagraph("BIC");
            row1.Cells[1].AddParagraph("IBAN");
            row1.Height = "0.6cm";

            row       = table.AddRow();
            row.Style = "BottomValue";
            row.Cells[0].AddParagraph(Company.BIC);
            row.Cells[1].AddParagraph(Company.IBAN);
            row.Cells[1].MergeRight = 1;

            table.AddRow();

            row1.Cells[2].MergeDown = 2;
            row1.Cells[2].Style     = "BottomInfo";
            row1.Cells[2].AddParagraph(Company.Name);
            if (Company.ContactPerson != null)
            {
                row1.Cells[2].AddParagraph(Company.ContactPerson);
            }
            row1.Cells[2].AddParagraph(Company.Address);
            row1.Cells[2].AddParagraph($"{Company.PostalCode} {Company.City}" + (Company.Country != null ? " / " + Company.Country : ""));

            row1.Cells[3].MergeDown  = 2;
            row1.Cells[3].MergeRight = 1;
            row1.Cells[3].Style      = "BottomInfo";
            if (Company.Phone != null)
            {
                row1.Cells[3].AddParagraph(Company.Phone);
            }
            if (Company.Email != null)
            {
                row1.Cells[3].AddParagraph(Company.Email);
            }
            if (Company.WebPage != null)
            {
                row1.Cells[3].AddParagraph(Company.WebPage);
            }
            row1.Cells[3].AddParagraph("Y-tunnus " + Company.CompanyID);

            table.AddRow().Height = "0.5cm";

            Unit tableHeight = 0;

            foreach (Row r in table.Rows)
            {
                tableHeight += r.Height;
            }

            textFrame.Height = tableHeight + section.PageSetup.BottomMargin;
        }