示例#1
0
        public ActionResult Invoices(int id)
        {
            var quoteModel = quoteService.FilterIPInvoice(id);

            quoteModel.quote_items    = quoteItemService.FilterIPQuoteItems(quoteModel);
            quoteModel.client         = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user           = userService.FilterIPUsers(quoteModel.user_id);
            quoteModel.quote_tax_rate = quoteTaxRatesService.FilterIPQuoteTaxRates(quoteModel);
            quoteModel.quote_amount   = quoteAmountsService.FilterIPQuoteAmounts(quoteModel);
            quoteModel.client         = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user           = userService.FilterIPUsers(quoteModel.user_id);
            quoteModel.payment        = paymentService.FilterIPPaymentsByQuoteID(id);
            return(View(quoteModel));
        }
示例#2
0
        public ActionResult Billing(int id)
        {
            var quoteModel = quoteService.FilterBilling(id);

            quoteModel.quote_items = quoteItemService.FilterIPQuoteItems(quoteModel);
            quoteModel.client      = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user        = userService.FilterIPUsers(quoteModel.user_id);
            //quoteModel.quote_tax_rate = quoteTaxRatesService.FilterIPQuoteTaxRates(quoteModel);
            quoteModel.quote_amount = quoteAmountsService.FilterIPQuoteAmounts(quoteModel);
            quoteModel.client       = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user         = userService.FilterIPUsers(quoteModel.user_id);

            quoteModel.Client_list = clientService.FilterIPClients();

            return(View(quoteModel));
        }
示例#3
0
        private string GetHtmlString(int id)
        {
            string GridHtml, HTMLcontent = string.Empty, taxContent = string.Empty, tablecontent = string.Empty;
            var    invoiceModel  = quoteService.FilterAllType(id);
            var    quoteModel    = quoteService.FilterIPQuotes(id);
            var    lsQuotesModel = quoteItemService.FilterIPQuoteItems(quoteModel).ToList();

            quoteModel.client         = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user           = userService.FilterIPUsers(quoteModel.user_id);
            quoteModel.quote_tax_rate = quoteTaxRatesService.FilterIPQuoteTaxRates(quoteModel);
            quoteModel.quote_amount   = quoteAmountsService.FilterIPQuoteAmounts(quoteModel);
            quoteModel.client         = clientService.FilterIPClients(quoteModel.client_id);
            quoteModel.user           = userService.FilterIPUsers(quoteModel.user_id);


            int ClientID = invoiceModel.client_id;


            decimal taxtotal = 0;

            #region Quote Item
            tablecontent = tablecontent + HTMLTableHeader();

            //Products -- Quote Items
            //Products -- Quote Items
            if (lsQuotesModel.Count > 0)
            {
                TaxSummarylist = new Hashtable();
                //foreach (IPQuoteItemsModel quoteitems in lsQuotesModel)
                for (int i = 0; i < lsQuotesModel.Count; i++)
                {
                    var quoteitems = lsQuotesModel[i];
                    tablecontent = tablecontent + "<tr> ";
                    tablecontent = tablecontent + "<td> " + (i + 1).ToString() + "</td>";
                    tablecontent = tablecontent + "<td word-wrap:break-word> " + quoteitems.product.product_name + "</td>";
                    tablecontent = tablecontent + "<td> " + quoteitems.product.product_description + "</td>";
                    tablecontent = tablecontent + "<td> " + (quoteitems.item_quantity.HasValue ? quoteitems.item_quantity.Value.ToString("00") : string.Empty) + "</td>";
                    tablecontent = tablecontent + "<td> " + quoteitems.product.selling_price + "</td>";
                    tablecontent = tablecontent + "<td> " + (quoteitems.item_discount_amount.HasValue ? quoteitems.item_discount_amount.Value.ToString("00") : string.Empty) + "</td>";
                    tablecontent = tablecontent + "<td> " + quoteitems.product.tax_Model.tax_rate_percent.ToString("00") + "%</td>";
                    int sellingprice = 0;
                    int.TryParse(quoteitems.product.selling_price, out sellingprice);
                    var amtWithDiscount = (quoteitems.item_quantity.Value * sellingprice) - (quoteitems.item_discount_amount.HasValue ? quoteitems.item_discount_amount.Value : 0);
                    tablecontent = tablecontent + "<td>" + (amtWithDiscount + (amtWithDiscount * (quoteitems.product.tax_Model.tax_rate_percent / 100))).ToString("00") + "</td>";
                    tablecontent = tablecontent + "</tr>";

                    if (!TaxSummarylist.ContainsKey(quoteitems.item_tax_rate_id))
                    {
                        TaxSummarylist.Add(quoteitems.item_tax_rate_id, (quoteitems.item_price * quoteitems.item_quantity) - quoteitems.item_discount_amount);
                    }
                    else
                    {
                        taxtotal = Convert.ToDecimal(TaxSummarylist[quoteitems.item_tax_rate_id]);
                        TaxSummarylist.Remove(quoteitems.item_tax_rate_id);
                        TaxSummarylist.Add(quoteitems.item_tax_rate_id, taxtotal + ((quoteitems.item_price * quoteitems.item_quantity) - quoteitems.item_discount_amount));
                    }
                }
            }

            #endregion

            #region  tax
            // taxContent
            if (invoiceModel.quote_amount != null)
            {
                taxContent = taxContent + "<tr class=\"rtl\"> <td> Sub Total </td> <td> " + invoiceModel.quote_amount.quote_item_subtotal.ToString() + "</td></tr>";
                taxContent = taxContent + "<tr class=\"rtl\"> <td> Total Discount </td> <td> " + invoiceModel.quote_amount.quote_discount.ToString() + "</td></tr>";
                taxContent = taxContent + "<tr class=\"rtl\"> <td> CGST </td> <td> " + invoiceModel.quote_amount.quote_tax_total / 2 + "</td></tr>";
                taxContent = taxContent + "<tr class=\"rtl\"> <td> SGST </td> <td> " + invoiceModel.quote_amount.quote_tax_total / 2 + "</td></tr>";
                taxContent = taxContent + "<tr class=\"rtl\"> <td> Total </td> <td> " + invoiceModel.quote_amount.quote_total.ToString() + "</td></tr>";
            }

            #endregion

            GridHtml = HTMLcontent;

            StringBuilder HTMLbuilder = new StringBuilder();
            HTMLbuilder.Append(HTMLContentBuilder().ToString());

            HTMLbuilder.Append("<table>");

            HTMLbuilder.Append("<tr>");
            #region address
            HTMLbuilder.Append("<td width=\"40%\">");
            HTMLbuilder.Append("<table>");
            HTMLbuilder.Append("<tr>");

            {
                HTMLbuilder.Append("<td>");
                HTMLbuilder.Append("AMD Systems <br/>");
                HTMLbuilder.Append("1st First Floor Lakshmi theater complex<br/>");
                HTMLbuilder.Append("Anna Salai <br/>");
                HTMLbuilder.Append("Vellor 6320001<br/>");
                HTMLbuilder.Append("</td>");
            }
            //Logo
            {
                HTMLbuilder.Append("<td>");
                HTMLbuilder.Append("<img src=\"" + Server.MapPath("~/Content/") + "logo.jpg\" alt=\"Smiley face\" height=\"150\" width=\"150\"/>");
                HTMLbuilder.Append("</td>");
            }
            HTMLbuilder.Append("</tr>");
            HTMLbuilder.Append("</table>");
            HTMLbuilder.Append("</td>");


            HTMLbuilder.Append("<td class=\"rtl\" width=\"60%\">");
            HTMLbuilder.Append("<table>");
            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td>");
            HTMLbuilder.Append(GetClientDetails(Convert.ToInt32(ClientID)).ToString());
            HTMLbuilder.Append("</td>");

            HTMLbuilder.Append("</tr>");
            HTMLbuilder.Append("</table>");
            HTMLbuilder.Append("</td>");

            #endregion
            HTMLbuilder.Append("</tr>");


            HTMLbuilder.Append("<tr>");
            #region Quote Details
            HTMLbuilder.Append("<td>");
            HTMLbuilder.Append("<table  width=\"40%\">");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Quote No</td>");
            HTMLbuilder.Append("<td> " + quoteModel.quote_id.ToString());
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Quote Date</td>");
            HTMLbuilder.Append("<td> " + quoteModel.quote_date_created.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture));
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Delivery Notes</td>");
            HTMLbuilder.Append("<td> " + quoteModel.delivery_notes != null ? quoteModel.delivery_notes : string.Empty + "</td>");
            HTMLbuilder.Append("</tr>");
            HTMLbuilder.Append("</table>");

            HTMLbuilder.Append("</td>");


            HTMLbuilder.Append("<td >");

            HTMLbuilder.Append("<table width=\"60%\">");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Payment Method</td>");
            HTMLbuilder.Append("<td> CASH </td>");
            HTMLbuilder.Append("</tr>");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Amount Due</td>");
            HTMLbuilder.Append("<td> " + quoteModel.quote_amount.quote_total);
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td> Tax</td>");
            HTMLbuilder.Append("<td> " + quoteModel.quote_amount.quote_tax_total);
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");

            HTMLbuilder.Append("</table>");

            HTMLbuilder.Append("</td>");


            #endregion
            HTMLbuilder.Append("</tr>");



            #region  Final
            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td colspan=\"2\">");
            HTMLbuilder.Append("<table width=\"100%\" >");
            HTMLbuilder.Append(tablecontent);
            HTMLbuilder.Append("</table>");
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");



            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td  colspan=\"2\">");
            HTMLbuilder.Append("<table  width=\"100%\">");
            HTMLbuilder.Append(taxContent);
            HTMLbuilder.Append("</table>");
            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");


            if (invoiceModel.taxType != null)
            {
                isIGST = false;
            }
            else
            {
                isIGST = true;
            }

            HTMLbuilder.Append("<tr>");
            HTMLbuilder.Append("<td  colspan=\"2\">");

            //   HTMLbuilder.Append(TaxSummary());

            HTMLbuilder.Append("</td>");
            HTMLbuilder.Append("</tr>");

            #endregion



            HTMLbuilder.Append("</table>");


            HTMLbuilder.Append("</div>");
            HTMLbuilder.Append("</body>");
            HTMLbuilder.Append("</html>");


            GridHtml = HTMLbuilder.ToString();
            return(GridHtml);
        }