Beispiel #1
0
        public void ExportBudgetForPrimavera(string saveLoc, int budgetID)
        {
            SqlDataReader dr;
            C1XLBook      book  = new C1XLBook();
            XLSheet       sheet = book.Sheets[0];
            int           indx;
            decimal       tmpRate;

            // must be output with the following columns
            // code,blank,description,quantity,uom,hours,rate,cost

            dr = CBBudgetLine.GetExportListByBudget(budgetID);

            indx    = 0;
            tmpRate = 0;

            while (dr.Read())
            {
                sheet[indx, 3].Value = dr["Activity"];                                                      //  code
                sheet[indx, 4].Value = "";                                                                  //  blank
                sheet[indx, 5].Value = dr["FullDescription"];                                               //  description
                sheet[indx, 6].Value = dr["Quantity"].ToString();                                           //  quantity
                sheet[indx, 7].Value = dr["UOM"];                                                           //  uom
                sheet[indx, 8].Value = dr["TotalHours"].ToString();                                         //  hours
                tmpRate = GetHourRate(Convert.ToInt32(dr["TotalHours"]), Convert.ToDecimal(dr["TotalDollars"]));
                sheet[indx, 9].Value  = tmpRate.ToString("#,##0.00");                                       //  rate
                sheet[indx, 10].Value = Convert.ToDecimal(dr["TotalDollars"]).ToString("#,##0.00");         //  cost

                indx++;
            }

            dr.Close();

            book.Save(saveLoc);
        }
Beispiel #2
0
        public void ExportBudgetForPrimavera(string saveLoc, int PCNID)
        {
            SqlDataReader dr;
            C1XLBook      book  = new C1XLBook();
            XLSheet       sheet = book.Sheets[0];
            int           indx;
            decimal       tmpRate;

            // must be output with the following columns
            // code,blank,description,quantity,uom,hours,rate,cost

            // dr = CBBudgetLine.GetExportListByBudget(budgetID);
            dr = CBBudgetLine.GetExportList_Expense_ByPCNID(PCNID);

            indx    = 1;
            tmpRate = 0;

            sheet[0, 3].Value  = "PCNID";
            sheet[0, 4].Value  = "Code";
            sheet[0, 5].Value  = "Description";
            sheet[0, 6].Value  = "DlrsPerItem"; //  quantity
            sheet[0, 7].Value  = "NumItems";
            sheet[0, 8].Value  = "MUPerc";
            sheet[0, 9].Value  = "MarkUp";                                                          //  uom
            sheet[0, 10].Value = "TotalCost";



            while (dr.Read())
            {
                sheet[indx, 3].Value = dr["PCNID"];                                                      //  code

                sheet[indx, 4].Value = dr["Code"];
                //  description
                sheet[indx, 5].Value  = dr["Description"].ToString();
                sheet[indx, 6].Value  = dr["DlrsPerItem"]; //  quantity
                sheet[indx, 7].Value  = dr["NumItems"];
                sheet[indx, 8].Value  = dr["MUPerc"];
                sheet[indx, 9].Value  = dr["MarkUp"];                                                       //  uom
                sheet[indx, 10].Value = dr["TotalCost"].ToString();                                         //  hours
                // tmpRate = GetHourRate(Convert.ToInt32(dr["TotalHours"]), Convert.ToDecimal(dr["TotalDollars"]));
                // sheet[indx, 9].Value = tmpRate.ToString("#,##0.00");                                        //  rate
                // sheet[indx, 10].Value = Convert.ToDecimal(dr["TotalDollars"]).ToString("#,##0.00");         //  cost

                indx++;
            }
            dr.Close();

            book.Save(saveLoc);
        }