Exemple #1
0
        private void Parte3()
        {
            Tabela   table = new Tabela(11);
            PdfPCell cell;

            cell         = new CelulaCabecalho(Frase("Total", 10));
            cell.Colspan = 7;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase(total_pedido.ToString("#,###,##0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase(total_valor.ToString("#,###,##0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            float media = (percentual_comissao / nitens);

            cell                     = new CelulaCabecalho(Frase(media.ToString("#0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase(total_comissao.ToString("#,###,##0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("", 10));
            cell.Colspan = 9;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("Pago", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase(total_pago.ToString("#,###,##0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);
            //
            cell         = new CelulaCabecalho(Frase("", 10));
            cell.Colspan = 9;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("Pagar", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase(total_pagar.ToString("#,###,##0.00"), 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            doc.Add(table);
        }
        private void Parte3(ArrayList areas, bool mostrar_valores)
        {
            CelulaCabecalho cell;
            CelulaItem      cellI;
            Tabela          table = new Tabela(mostrar_valores ? 31 : 24);

            // cabecalho
            cell         = new CelulaCabecalho(Frase("ITEM", 10));
            cell.Colspan = 1;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("QTD", 10));
            cell.Colspan = 1;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("COD FIXO", 10));
            cell.Colspan = 2;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("COD VARIÁVEL", 10));
            cell.Colspan = 5;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("DESCRIÇÃO", 10));
            cell.Colspan = 11;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("MEDIDA", 10));
            cell.Colspan = 4;
            table.AddCell(cell);

            if (mostrar_valores)
            {
                cell                     = new CelulaCabecalho(Frase("R$ UNIT S/IPI", 10));
                cell.Colspan             = 3;
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);

                cell         = new CelulaCabecalho(Frase("IPI%", 10));
                cell.Colspan = 1;
                table.AddCell(cell);

                cell                     = new CelulaCabecalho(Frase("R$ TOTAL C/IPI", 10));
                cell.Colspan             = 3;
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cell);
            }

            total = 0;
            int seq = 0;

            foreach (Area area in areas)
            {
                foreach (Item item in area.itens)
                {
                    // itens
                    char   letra = (char)((int)'A' + seq++);
                    string s     = letra.ToString();
                    cellI         = new CelulaItem(Frase(s, 10));             // item
                    cellI.Colspan = 1;
                    table.AddCell(cellI);

                    cellI         = new CelulaItem(Frase(item.qtde.ToString(), 10));             // qtd
                    cellI.Colspan = 1;
                    table.AddCell(cellI);

                    cellI         = new CelulaItem(Frase(item.codigo, 10));             // fixo
                    cellI.Colspan = 2;
                    table.AddCell(cellI);

                    cellI         = new CelulaItem(Frase(item.especificos, 10));             // variavel
                    cellI.Colspan = 5;
                    table.AddCell(cellI);

                    cellI         = new CelulaItem(Frase(item.descricao, 10));             // descricao
                    cellI.Colspan = 11;
                    table.AddCell(cellI);

                    cellI         = new CelulaItem(Frase(item.medidas, 10));             // medida
                    cellI.Colspan = 4;
                    table.AddCell(cellI);

                    if (mostrar_valores)
                    {
                        cellI                     = new CelulaItem(Frase(item.vlr_semipi.ToString("###,###,##0.00"), 10));     // sem ipi
                        cellI.Colspan             = 3;
                        cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                        table.AddCell(cellI);

                        cellI         = new CelulaItem(Frase(item.ipi.ToString(), 10));                 // ipi
                        cellI.Colspan = 1;
                        table.AddCell(cellI);

                        cellI                     = new CelulaItem(Frase(item.vlr_unitario.ToString("###,###,##0.00"), 10));     // com ipi
                        cellI.Colspan             = 3;
                        cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                        table.AddCell(cellI);
                    }

                    total += item.vlr_unitario;
                }
            }
            doc.Add(table);
        }
Exemple #3
0
        private void Parte2(DataGridView dgv, bool justificativas)
        {
            CelulaCabecalho cell;
            CelulaItem      cellI;
            Tabela          table = new Tabela(11);

            // cabecalho
            cell         = new CelulaCabecalho(Frase("Fornecedor", 10));
            cell.Colspan = 2;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("Data", 10));
            cell.Colspan = 1;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("Orçamento", 10));
            cell.Colspan = 1;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("Pedido", 10));
            cell.Colspan = 1;
            table.AddCell(cell);

            cell         = new CelulaCabecalho(Frase("Cliente", 10));
            cell.Colspan = 2;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("Vlr Pedido", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("Valor", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("%Pago", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell                     = new CelulaCabecalho(Frase("Comissão", 10));
            cell.Colspan             = 1;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            percentual_comissao = 0;
            total_comissao      = 0;
            total_pedido        = 0;
            total_valor         = 0;
            total_pago          = 0;
            total_pagar         = 0;
            nitens = 0;

            foreach (DataGridViewRow row in dgv.Rows)
            {
                /*
                 * if (!(bool)row.Cells["S"].Value)
                 * {
                 *      continue;
                 * }
                 * bool pg=false;
                 * if (por_vendedor)
                 *      pg = row.Cells["IdtVendedor"].Value.ToString().Equals("S");
                 * if (por_consultor)
                 *      pg = row.Cells["IdtConsultor"].Value.ToString().Equals("S");
                 * if (por_filial)
                 *      pg = row.Cells["IdtFilial"].Value.ToString().Equals("S");
                 */
                bool pg = (bool)row.Cells["PG"].Value;

                if (!mostra_pagar && !pg)
                {
                    continue;
                }
                if (!mostra_pago && pg)
                {
                    continue;
                }
                cellI         = new CelulaItem(Frase(row.Cells["Fornecedor"].Value.ToString(), 10));
                cellI.Colspan = 2;
                table.AddCell(cellI);

                cellI         = new CelulaItem(Frase(row.Cells["Data"].Value.ToString(), 10));
                cellI.Colspan = 1;
                table.AddCell(cellI);

                cellI         = new CelulaItem(Frase(row.Cells["Orcamento"].Value.ToString(), 10));
                cellI.Colspan = 1;
                table.AddCell(cellI);

                cellI         = new CelulaItem(Frase(row.Cells["Pedido"].Value.ToString(), 10));
                cellI.Colspan = 1;
                table.AddCell(cellI);

                cellI         = new CelulaItem(Frase(row.Cells["Cliente"].Value.ToString(), 10));
                cellI.Colspan = 2;
                table.AddCell(cellI);

                cellI                     = new CelulaItem(Frase(Globais.StrToFloat(row.Cells["ValorPedido"].Value.ToString()).ToString("#,###,##0.00"), 10));
                cellI.Colspan             = 1;
                cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cellI);

                cellI                     = new CelulaItem(Frase(Globais.StrToFloat(row.Cells["Valor"].Value.ToString()).ToString("#,###,##0.00"), 10));
                cellI.Colspan             = 1;
                cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cellI);

                //cellI = new CelulaItem(Frase(Globais.StrToFloat(row.Cells["PerVendedor"].Value.ToString()).ToString("#0.00"), 10));
                cellI                     = new CelulaItem(Frase(Globais.StrToFloat(row.Cells["Pago"].Value.ToString()).ToString("#0.00"), 10));
                cellI.Colspan             = 1;
                cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cellI);

                float comissao = Globais.StrToFloat(row.Cells["Comissao"].Value.ToString());
                //float valor = Globais.StrToFloat(row.Cells["Valor"].Value.ToString());
                //float per_pago = Globais.StrToFloat(row.Cells["PerVendedor"].Value.ToString());
                //float comissao = per_pago * valor / 100f;
                cellI                     = new CelulaItem(Frase(comissao.ToString("#,###,##0.00"), 10));
                cellI.Colspan             = 1;
                cellI.HorizontalAlignment = Element.ALIGN_RIGHT;
                table.AddCell(cellI);
                percentual_comissao += Globais.StrToFloat(row.Cells["Pago"].Value.ToString());
                total_comissao      += comissao;
                total_pedido        += Globais.StrToFloat(row.Cells["ValorPedido"].Value.ToString());
                total_valor         += Globais.StrToFloat(row.Cells["Valor"].Value.ToString());
                if ((bool)row.Cells["PG"].Value)
                {
                    total_pago += comissao;
                }
                else
                {
                    total_pagar += comissao;
                }

                if (justificativas)
                {
                    string justificativa = row.Cells["Justificativa"].Value.ToString().Trim();
                    if (justificativa.Length > 0)
                    {
                        cellI         = new CelulaItem(Frase("Justificativa: " + justificativa, 10));
                        cellI.Colspan = 11;
                        table.AddCell(cellI);
                    }
                }
                nitens++;
            }
            doc.Add(table);
        }