Exemple #1
0
        public static Print_quotationItemsList GetData(string p_id)
        {
            Print_quotationItemsList list = new Print_quotationItemsList();
            //
            List <Quotationitems> inv_item_list = new List <Quotationitems>();

            //if (Customise.Invoice_poid_dcid == true)
            //{
            //    inv_item_list = CQuotationitems_exten.FKId(p_id, new DAL());
            //}

            //if ((Customise.Invoice_pono_dcno == true) || (Customise.Invoice_Without_podc == true))
            //{
            inv_item_list = CQuotationitems_exten.FKNo(p_id, new DAL());
            //}

            for (int r = 0; r <= inv_item_list.Count - 1; r++)
            {
                Print_quotationitemsRow row = new Print_quotationitemsRow();
                //
                row.QUOTATION_ITEM_ID = inv_item_list[r].Quotationitems_id;
                row.QUOTATION_ID      = inv_item_list[r].Quotation_id;
                row.SL_NO             = (r + 1).ToString();

                row.PRODUCT_ID = Checks.RemoveEscape(inv_item_list[r].Product_id);

                row.HSN_CODE_ID = Ccoreplus.GetHsncode_name(inv_item_list[r].Product_id);


                row.SIZES_ID = inv_item_list[r].Sizes_id;

                row.QTY = ConvertTO.DecimalToS(inv_item_list[r].Qty);

                row.PRICE = ConvertTO.Decimal2d(inv_item_list[r].Price.ToString());

                decimal vAmount       = 0M;
                decimal vTaxableValue = 0M;

                decimal vQty   = Global.ToDecimal(row.QTY);
                decimal vPrice = Global.ToDecimal(row.PRICE);


                vTaxableValue = vQty * vPrice;

                vAmount = vTaxableValue;

                row.TAXABLEVALUE = ConvertTO.Decimal2d(vTaxableValue.ToString());



                row.SUB_TOTAL = ConvertTO.Decimal2d(vAmount.ToString());
                //
                list.Add(row);
                //
            }
            //
            return(list);
        }
Exemple #2
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "&CLOSE";
                obj           = CQuotation_exten.PKId(pPkValue, new DAL());
                list          = CQuotationitems_exten.FKNo(pPkValue, new DAL());

                this.EnableControls(false);
                break;

            case BtnEvent.New:
                btn_save.Text = "&SAVE";
                obj           = CQuotation.GetNew;
                list          = CQuotationitems.GetNew;
                this.EnableControls(true);
                break;

            case BtnEvent.Edit:
                btn_save.Text = "&UPDATE";
                obj           = CQuotation_exten.PKId(pPkValue, new DAL());
                list          = CQuotationitems_exten.FKNo(pPkValue, new DAL());
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\n&DELETE";
                obj           = CQuotation_exten.PKId(pPkValue, new DAL());
                list          = CQuotationitems_exten.FKNo(pPkValue, new DAL());
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "&PRINT";
                obj           = CQuotation_exten.PKId(pPkValue, new DAL());
                list          = CQuotationitems_exten.FKNo(pPkValue, new DAL());
                this.EnableControls(false);
                break;
            }

            LoadData(obj);
            Loaditems(list);
        }
Exemple #3
0
        private static Print_QuotationList GetData(string p_id)
        {
            Quotation quotation = CQuotation_exten.PKId(p_id, new DAL());

            Print_QuotationList list = new Print_QuotationList();

            Print_QuotationRow row = new Print_QuotationRow();

            Company obj = CCompany_exten.PKId(Current.Company_id);

            row.COMPANY_NAME = obj.Display_name.ToUpper();
            row.ADDRESS1     = obj.Street1 + " , " + obj.Street2;
            row.ADDRESS2     = obj.City_id + " - " + obj.Pincode_id + " , " + obj.State_id + ". Code -33,    Email : " + obj.Email;
            row.COMPANY_TIN  = " GSTIN : " + obj.Gstin + "";// ,    Cell :    " + obj.Cell1 + " ";

            row.QUOTATION_ID   = p_id;
            row.QUOTATION_NO   = "NO    : " + quotation.Quotation_no.ToString();
            row.QUOTATION_DATE = "DATE  : " + ConvertTO.Date2S(quotation.Quotation_date);

            row.PARTY_NAME = quotation.Party_id;

            Party _party_list = CParty_exten.SearchName(quotation.Party_id, new DAL());

            if (_party_list.Party_name != null)
            {
                row.STREET1 = _party_list.Street_1 + ", " + _party_list.Street_2;
                row.STREET2 = "";
                row.CITY    = _party_list.City_id + " - " + _party_list.Pincode_id + " ,";
                //row.STATE = _party_list.State_id + " - " + CState_exten.GetStateCode(_party_list.State_id);
                row.COUNTRY = _party_list.Country_id;
                row.PINCODE = "";

                if (_party_list.Gstin.Trim().Length != 0)
                {
                    row.GSTIN += "GSTIN No : " + _party_list.Gstin;
                }
            }

            row.TOTAL_QTY = ConvertTO.DecimalToS(quotation.Total_qty.ToString());

            row.TAXABLE_VALUE = ConvertTO.Decimal2d(quotation.Total_taxable_amount.ToString());


            List <Quotationitems> klist = CQuotationitems_exten.FKId(p_id, new DAL());

            row.TOTAL_SUB = (Global.ToDecimal(row.TAXABLE_VALUE).ToString());

            if (quotation.Ledger_id != null)
            {
                if (quotation.Ledger_id.Trim() != "")
                {
                    row.LEDGER = "Add TAX Invoice " + quotation.Ledger_id;
                }
                else
                {
                    row.LEDGER = "";
                }
            }

            row.ADDITIONAL      = quotation.Additional.ToString();
            row.OUTSTANDING     = "Total Outstanding Amount : " + CQuotation_exten.GetBalance(CParty_exten.GetId_Name(quotation.Party_id));
            row.GRANDTOTAL      = quotation.Grandtotal.ToString();
            row.AMOUNT_IN_WORDS = "Rupees   : " + Global.AmountInWords(Convert.ToDecimal(quotation.Grandtotal));

            list.Add(row);

            return(list);
        }
Exemple #4
0
        private void Save_Event(string info)
        {
            if (Validation() != false)
            {
                switch (fAction)
                {
                case BtnEvent.Open:

                    if (info != Core.saveprint)
                    {
                        this.Hide();
                        Form_NeedToRefresh();
                    }
                    else
                    {
                        Print_copies();
                        this.Hide();
                        Form_NeedToRefresh();
                    }

                    break;

                case BtnEvent.New:
                    try
                    {
                        var vData = CollectData();

                        dalsession = new DAL();
                        dalsession.BeginTransaction();
                        CQuotation.Insert(vData, dalsession);
                        vId = DAL.GetIdentity(dalsession);
                        var itemsList = Collectitems(vId);
                        CQuotationitems.Insert(itemsList, dalsession);
                        CSeq_exten.UpdateNextNo(SEQ.QUOTATION_NO, dalsession);
                        dalsession.Commit();

                        if (info != Core.saveprint)
                        {
                            MessageBox.Show(this.FindForm(), "Record Saved Successfully.", "Save...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            Print_copies();
                            this.Hide();
                            Form_NeedToRefresh();
                        }
                        //this.Hide();
                        //Form_NeedToRefresh();

                        SetAction(BtnEvent.New, null);
                        txt_quotation_no.Focus();
                    }
                    catch (Exception ex)
                    {
                        if (dalsession != null)
                        {
                            dalsession.Rollback();
                        }
                        MessageBox.Show(this.FindForm(), "Something Goes Wrong \r\n" + ex.Message, "Could Not Save...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        SetFocus();
                        return;
                    }
                    break;

                case BtnEvent.Edit:
                    try
                    {
                        var vData = CollectData();

                        dalsession = new DAL();
                        dalsession.BeginTransaction();

                        var olditemslist = CQuotationitems_exten.FK_withoutJoin(vId, new DAL());

                        CQuotationitems.Delete(vId, dalsession);
                        CQuotation.Update(vData, dalsession);
                        var itemsList = Collectitems(vId);
                        CQuotationitems.Insert(itemsList, dalsession);


                        //if (Customise.Invoice_poid_dcid == true)
                        //{
                        //    CDc_refered.Refered(itemsList, olditemslist, dalsession);
                        //}

                        dalsession.Commit();

                        if (info != Core.saveprint)
                        {
                            MessageBox.Show(this.FindForm(), "Record Updated Successfully.", "Update...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            Print_copies();
                        }
                        this.Hide();
                        Form_NeedToRefresh();
                    }
                    catch (Exception ex)
                    {
                        if (dalsession != null)
                        {
                            dalsession.Rollback();
                        }
                        MessageBox.Show(this.FindForm(), "Something Goes Wrong \r\n" + ex.Message, "Could Not Update...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        SetFocus();
                        return;
                    }
                    break;

                case BtnEvent.Delete:
                    try
                    {
                        dalsession = new DAL();
                        dalsession.BeginTransaction();
                        CQuotationitems.Delete(vId, dalsession);
                        CQuotation.Delete(vId, dalsession);
                        var olditemslist = CQuotationitems_exten.FK_withoutJoin(vId, new DAL());

                        //if (Customise.Invoice_poid_dcid == true)
                        //{
                        //    CDc_refered.Refered(olditemslist, olditemslist, dalsession);
                        //}

                        dalsession.Commit();

                        MessageBox.Show(this.FindForm(), "Record Deleted Successfully.", "Delete...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Hide();
                        Form_NeedToRefresh();
                    }
                    catch (Exception ex)
                    {
                        if (dalsession != null)
                        {
                            dalsession.Rollback();
                        }
                        MessageBox.Show(this.FindForm(), "Something Goes Wrong \r\n" + ex.Message, "Could Not Update...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        SetFocus();
                        return;
                    }
                    break;

                case BtnEvent.Print:
                    Print_copies();
                    this.Hide();
                    Form_NeedToRefresh();
                    break;
                }
            }
        }