Exemplo n.º 1
0
 private static string AttachParams(string q, Creditnote v)
 {
     q = q.Replace("@" + CREDITNOTE.CREDITNOTE_ID + "@", "" + ConvertTO.SqlString(v.Creditnote_id) + "");
     q = q.Replace("@" + CREDITNOTE.UNIQUENO + "@", "" + ConvertTO.SqlString(v.Uniqueno) + "");
     q = q.Replace("@" + CREDITNOTE.COMPANY_ID + "@", "" + ConvertTO.SqlString(v.Company_id) + "");
     q = q.Replace("@" + CREDITNOTE.ACY_ID + "@", "" + ConvertTO.SqlString(v.Acy_id) + "");
     q = q.Replace("@" + CREDITNOTE.ORDER_ID + "@", "" + ConvertTO.SqlString(v.Order_id) + "");
     q = q.Replace("@" + CREDITNOTE.CREDITNOTE_NO + "@", "" + ConvertTO.SqlString(v.Creditnote_no) + "");
     q = q.Replace("@" + CREDITNOTE.CREDITNOTE_DATE + "@", "" + ConvertTO.SqlDate(v.Creditnote_date) + "");
     q = q.Replace("@" + CREDITNOTE.TAXTYPE_ID + "@", "" + ConvertTO.SqlString(v.Taxtype_id) + "");
     q = q.Replace("@" + CREDITNOTE.SALESTYPE_ID + "@", "" + ConvertTO.SqlString(v.Salestype_id) + "");
     q = q.Replace("@" + CREDITNOTE.PARTY_ID + "@", "" + ConvertTO.SqlString(v.Party_id) + "");
     q = q.Replace("@" + CREDITNOTE.TOTAL_QTY + "@", "" + ConvertTO.SqlString(v.Total_qty) + "");
     q = q.Replace("@" + CREDITNOTE.TOTAL_TAXABLE_AMOUNT + "@", "" + ConvertTO.SqlDecimal(v.Total_taxable_amount) + "");
     q = q.Replace("@" + CREDITNOTE.TOTAL_CGST + "@", "" + ConvertTO.SqlDecimal(v.Total_cgst) + "");
     q = q.Replace("@" + CREDITNOTE.TOTAL_SGST + "@", "" + ConvertTO.SqlDecimal(v.Total_sgst) + "");
     q = q.Replace("@" + CREDITNOTE.TOTAL_IGST + "@", "" + ConvertTO.SqlDecimal(v.Total_igst) + "");
     q = q.Replace("@" + CREDITNOTE.GSTTOTAL + "@", "" + ConvertTO.SqlDecimal(v.Gsttotal) + "");
     q = q.Replace("@" + CREDITNOTE.LEDGER_ID + "@", "" + ConvertTO.SqlString(v.Ledger_id) + "");
     q = q.Replace("@" + CREDITNOTE.ADDITIONAL + "@", "" + ConvertTO.SqlDecimal(v.Additional) + "");
     q = q.Replace("@" + CREDITNOTE.ROUNDS + "@", "" + ConvertTO.SqlDecimal(v.Rounds) + "");
     q = q.Replace("@" + CREDITNOTE.GRANDTOTAL + "@", "" + ConvertTO.SqlDecimal(v.Grandtotal) + "");
     q = q.Replace("@" + CREDITNOTE.REFERED_AMT + "@", "" + ConvertTO.SqlDecimal(v.Refered_amt) + "");
     q = q.Replace("@" + CREDITNOTE.LOCKED + "@", "" + ConvertTO.SqlString(v.Locked) + "");
     q = q.Replace("@" + CREDITNOTE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + CREDITNOTE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + CREDITNOTE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Exemplo n.º 2
0
        public static void Update(Creditnote v, DAL dalsession)
        {
            string q = "UPDATE " + CREDITNOTE.CREDITNOTE_TBL + " SET";

            q += " " + CREDITNOTE.UNIQUENO + " = @" + CREDITNOTE.UNIQUENO + "@ \r\n ";
            q += "," + CREDITNOTE.COMPANY_ID + " = @" + CREDITNOTE.COMPANY_ID + "@ \r\n ";
            q += "," + CREDITNOTE.ACY_ID + " = @" + CREDITNOTE.ACY_ID + "@ \r\n ";
            q += "," + CREDITNOTE.ORDER_ID + " = @" + CREDITNOTE.ORDER_ID + "@ \r\n ";
            q += "," + CREDITNOTE.CREDITNOTE_NO + " = @" + CREDITNOTE.CREDITNOTE_NO + "@ \r\n ";
            q += "," + CREDITNOTE.CREDITNOTE_DATE + " = @" + CREDITNOTE.CREDITNOTE_DATE + "@ \r\n ";
            q += "," + CREDITNOTE.TAXTYPE_ID + " = @" + CREDITNOTE.TAXTYPE_ID + "@ \r\n ";
            q += "," + CREDITNOTE.SALESTYPE_ID + " = @" + CREDITNOTE.SALESTYPE_ID + "@ \r\n ";
            q += "," + CREDITNOTE.PARTY_ID + " = @" + CREDITNOTE.PARTY_ID + "@ \r\n ";
            q += "," + CREDITNOTE.TOTAL_QTY + " = @" + CREDITNOTE.TOTAL_QTY + "@ \r\n ";
            q += "," + CREDITNOTE.TOTAL_TAXABLE_AMOUNT + " = @" + CREDITNOTE.TOTAL_TAXABLE_AMOUNT + "@ \r\n ";
            q += "," + CREDITNOTE.TOTAL_CGST + " = @" + CREDITNOTE.TOTAL_CGST + "@ \r\n ";
            q += "," + CREDITNOTE.TOTAL_SGST + " = @" + CREDITNOTE.TOTAL_SGST + "@ \r\n ";
            q += "," + CREDITNOTE.TOTAL_IGST + " = @" + CREDITNOTE.TOTAL_IGST + "@ \r\n ";
            q += "," + CREDITNOTE.GSTTOTAL + " = @" + CREDITNOTE.GSTTOTAL + "@ \r\n ";
            q += "," + CREDITNOTE.LEDGER_ID + " = @" + CREDITNOTE.LEDGER_ID + "@ \r\n ";
            q += "," + CREDITNOTE.ADDITIONAL + " = @" + CREDITNOTE.ADDITIONAL + "@ \r\n ";
            q += "," + CREDITNOTE.ROUNDS + " = @" + CREDITNOTE.ROUNDS + "@ \r\n ";
            q += "," + CREDITNOTE.GRANDTOTAL + " = @" + CREDITNOTE.GRANDTOTAL + "@ \r\n ";
            q += "," + CREDITNOTE.REFERED_AMT + " = @" + CREDITNOTE.REFERED_AMT + "@ \r\n ";
            q += "," + CREDITNOTE.LOCKED + " = @" + CREDITNOTE.LOCKED + "@ \r\n ";
            q += "," + CREDITNOTE.NOTES + " = @" + CREDITNOTE.NOTES + "@ \r\n ";
            q += "," + CREDITNOTE.ACTIVE_ID + " = @" + CREDITNOTE.ACTIVE_ID + "@ \r\n ";
            q += "," + CREDITNOTE.USER_ID + " = @" + CREDITNOTE.USER_ID + "@ \r\n ";
            q += "  WHERE " + CREDITNOTE.CREDITNOTE_ID + " = @" + CREDITNOTE.CREDITNOTE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Exemplo n.º 3
0
        private Creditnote CollectData()
        {
            Creditnote fobj = new Creditnote()
            {
                Creditnote_id = vId,
                Uniqueno      = Current.Acy_id + "~" + Current.Company_id + "~" + txt_invoice_no.Text,
                Company_id    = Current.Company_id,
                //Div_id = Current.Div_id,
                Acy_id               = Current.Acy_id,
                Order_id             = COrder_exten.GetId_Name(txt_order_id.Text, "", "", ""),
                Creditnote_no        = txt_invoice_no.Text,
                Creditnote_date      = txt_invoice_date.Text,
                Party_id             = CParty_exten.GetId_Name(txt_party_id.Text),
                Taxtype_id           = CTaxtype_exten.GetId_Name(txt_taxtype_id.Text),
                Salestype_id         = CSalestype_exten.GetId_Name(txt_salestype_id.Text),
                Total_qty            = txt_total_qty.Text,
                Total_taxable_amount = ConvertTO.Decimal(vTotTaxable.ToString()),
                Total_cgst           = ConvertTO.Decimal(vTotCgst.ToString()),
                Total_sgst           = ConvertTO.Decimal(vTotSgst.ToString()),
                Total_igst           = ConvertTO.Decimal(vTotIgst.ToString()),
                Gsttotal             = ConvertTO.Decimal(txt_gsttotal.Text),
                Ledger_id            = CLedger_exten.GetId_Name(txt_ledger_id.Text),
                Additional           = ConvertTO.Decimal(txt_additional.Text),
                Rounds               = ConvertTO.Decimal(vRoundoff.ToString()),
                Grandtotal           = ConvertTO.Decimal(txt_grandtotal.Text),
                Refered_amt          = ConvertTO.Decimal(txt_grandtotal.Text),
                Locked               = Core.Unlocked,
                Active_id            = Core.Stative,
                Notes   = txt_notes.Text,
                User_id = Current.User
            };

            return(fobj);
        }
Exemplo n.º 4
0
        public static string GetName_Id(string Id)
        {
            Creditnote obj = PKId(Id);

            if (obj != null)
            {
                return(obj.Creditnote_no.ToString());
            }
            return("");
        }
Exemplo n.º 5
0
 public static bool LockStatus(string pkValue)
 {
     if (pkValue != null)
     {
         Creditnote obj = PKId(pkValue);
         if (obj.Locked == Core.Unlocked)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 6
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "&CLOSE";
                obj           = CCreditnote_exten.PKId(pPkValue);
                list          = CCreditnoteitems_exten.FKId(pPkValue);
                this.EnableControls(false);
                break;

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

            case BtnEvent.Edit:
                btn_save.Text = "&UPDATE";
                obj           = CCreditnote_exten.PKId(pPkValue);
                list          = CCreditnoteitems_exten.FKId(pPkValue);
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\n&DELETE";
                obj           = CCreditnote_exten.PKId(pPkValue);
                list          = CCreditnoteitems_exten.FKId(pPkValue);
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "&PRINT";
                obj           = CCreditnote_exten.PKId(pPkValue);
                list          = CCreditnoteitems_exten.FKId(pPkValue);
                this.EnableControls(false);
                print_panel.Show();
                break;
            }

            LoadData(obj);
            Loaditems(list);
        }
Exemplo n.º 7
0
        private static List <Creditnote> EntityList(string q)
        {
            List <Creditnote> list = new List <Creditnote>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Creditnote obj = new Creditnote()
                    {
                        Creditnote_id        = redr[CREDITNOTE.CREDITNOTE_ID].ToString(),
                        Uniqueno             = redr[CREDITNOTE.UNIQUENO].ToString(),
                        Company_id           = redr[CREDITNOTE.COMPANY_ID].ToString(),
                        Acy_id               = redr[CREDITNOTE.ACY_ID].ToString(),
                        Order_id             = redr[ORDER.ORDER_NO].ToString(),
                        Creditnote_no        = redr[CREDITNOTE.CREDITNOTE_NO].ToString(),
                        Creditnote_date      = redr[CREDITNOTE.CREDITNOTE_DATE].ToString(),
                        Party_id             = redr[PARTY.PARTY_NAME].ToString(),
                        Taxtype_id           = redr[TAXTYPE.TAXTYPE_NAME].ToString(),
                        Salestype_id         = redr[SALESTYPE.SALESTYPE_NAME].ToString(),
                        Total_qty            = redr[CREDITNOTE.TOTAL_QTY].ToString(),
                        Total_taxable_amount = ConvertTO.Decimal(redr[CREDITNOTE.TOTAL_TAXABLE_AMOUNT].ToString()),
                        Total_cgst           = ConvertTO.Decimal(redr[CREDITNOTE.TOTAL_CGST].ToString()),
                        Total_sgst           = ConvertTO.Decimal(redr[CREDITNOTE.TOTAL_SGST].ToString()),
                        Total_igst           = ConvertTO.Decimal(redr[CREDITNOTE.TOTAL_IGST].ToString()),
                        Gsttotal             = ConvertTO.Decimal(redr[CREDITNOTE.GSTTOTAL].ToString()),
                        Ledger_id            = redr[CREDITNOTE.LEDGER_ID].ToString(),
                        Additional           = ConvertTO.Decimal(redr[CREDITNOTE.ADDITIONAL].ToString()),
                        Rounds               = ConvertTO.Decimal(redr[CREDITNOTE.ROUNDS].ToString()),
                        Grandtotal           = ConvertTO.Decimal(redr[CREDITNOTE.GRANDTOTAL].ToString()),
                        Refered_amt          = ConvertTO.Decimal(redr[CREDITNOTE.REFERED_AMT].ToString()),
                        Locked               = redr[CREDITNOTE.LOCKED].ToString(),
                        Notes     = redr[CREDITNOTE.NOTES].ToString(),
                        Active_id = redr[CREDITNOTE.ACTIVE_ID].ToString(),
                        User_id   = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
Exemplo n.º 8
0
 private void LoadData(Creditnote obj)
 {
     vId = obj.Creditnote_id;
     txt_order_id.Text     = obj.Order_id;
     txt_invoice_no.Text   = obj.Creditnote_no.ToString();
     txt_invoice_date.Text = obj.Creditnote_date;
     txt_party_id.Text     = obj.Party_id;
     txt_taxtype_id.Text   = obj.Taxtype_id;
     SetTaxtype();
     txt_salestype_id.Text = obj.Salestype_id;
     txt_total_qty.Text    = obj.Total_qty.ToString();
     //txt_total_taxable_amount.Text = obj.Total_taxable_amount;
     txt_gsttotal.Text   = obj.Gsttotal.ToString();
     txt_ledger_id.Text  = CLedger_exten.GetName_Id(obj.Ledger_id);
     txt_additional.Text = obj.Additional.ToString();
     txt_grandtotal.Text = obj.Grandtotal.ToString();
     txt_balance.Text    = CCreditnote_exten.GetBalance(CParty_exten.GetId_Name(txt_party_id.Text)).ToString();
     txt_notes.Text      = obj.Notes;
     Core.Stative        = obj.Active_id;
     Setactives();
 }
        private static Print_CreditnoteList ReturnCreditnote(string Id, List <PrintCopies> printcopies)
        {
            Creditnote             invoice      = CCreditnote_exten.PKId(Id);
            List <Creditnoteitems> invoiceitems = CCreditnoteitems_exten.FKId(Id);

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

            Party party = CParty_exten.SearchName(invoice.Party_id, new DAL());

            Company_bank cmpbank = CCompany_bank_exten.PKId("1");

            Print_CreditnoteList list = new Print_CreditnoteList();

            for (int i = 0; i < printcopies.Count; i++)
            {
                Print_Creditnote row = new Print_Creditnote();

                row.COPY_NAME  = printcopies[i].Copies;
                row.SALES_TYPE = invoice.Salestype_id;
                row.TAX_TYPE   = invoice.Taxtype_id;

                row.COMPANY_NAME      = company.Display_name;
                row.COMPANY_ADDRESS_1 = company.Street1 + ", " + company.Street2;
                row.COMPANY_ADDRESS_2 = company.City_id + "- " + company.Pincode_id + ", " + company.State_id + " - (" + Ccoreplus.GetStateCode(company.State_id) + ") . Email :- " + company.Email;
                row.COMPANY_PHONE     = company.Phone;
                row.COMPANY_CELL1     = company.Cell1;
                row.COMPANY_CELL2     = company.Cell2;

                row.COMPANY_EMAIL   = company.Email;
                row.COMPANY_WEBSITE = company.Website;


                if (company.Gstin.Trim().Length != 0)
                {
                    row.COMPANY_GSTIN = "GSTIN : " + company.Gstin;

                    if (company.Cell1.Trim().Length != 0)
                    {
                        row.COMPANY_GSTIN = "GSTIN : " + company.Gstin + " , Mobile : " + company.Cell1;

                        if (company.Cell2.Trim().Length != 0)
                        {
                            row.COMPANY_GSTIN = "GSTIN : " + company.Gstin + " , Mobile : " + company.Cell1 + ", " + company.Cell2;
                        }
                    }
                }
                else
                {
                    row.COMPANY_GSTIN = "";
                }

                row.CREDITNOTE_ID   = invoice.Creditnote_id;
                row.CREDITNOTE_NO   = ":. " + invoice.Creditnote_no;
                row.CREDITNOTE_DATE = ":  " + ConvertTO.Date2S(invoice.Creditnote_date);

                row.PARTY_NAME     = party.Party_name;
                row.PARTY_STREET_1 = party.Street_1 + ",";

                if (party.Street_2.Trim().Length != 0)
                {
                    row.PARTY_STREET_2 = party.Street_2 + ",";
                }

                if (party.Pincode_id.Trim().Length == 6)
                {
                    row.PARTY_CITY = party.City_id + " - :" + party.Pincode_id + ",";
                }
                else
                {
                    row.PARTY_CITY = party.City_id + ",";
                }


                row.PARTY_STATE = party.State_id + " - (" + Ccoreplus.GetStateCode(party.State_id) + ").";

                row.PARTY_STATE_CODE = "";
                row.PARTY_COUNTRY    = party.Country_id;
                row.PARTY_PINCODE    = party.Pincode_id;

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

                row.TOTAL_QTY     = invoice.Total_qty.ToString();
                row.TAXABLE_VALUE = invoice.Total_taxable_amount.ToString();

                if (Customised.TaxType == Core.SGST)
                {
                    row.CGST_PERCENT = "  Add CGST " + (invoiceitems[0].Cgst_percent.ToString()) + " %";
                    row.SGST_PERCENT = "  Add SGST " + (invoiceitems[0].Sgst_percent.ToString()) + " %";

                    row.TOTAL_CGST = invoice.Total_cgst.ToString();
                    row.TOTAL_SGST = invoice.Total_sgst.ToString();
                }
                else if (Customised.TaxType == Core.IGST)
                {
                    row.CGST_PERCENT = "";
                    row.SGST_PERCENT = "  Add IGST " + (invoiceitems[0].Igst_percent.ToString()) + " %";

                    row.TOTAL_CGST = "";
                    row.TOTAL_SGST = invoice.Total_igst.ToString();
                }

                row.TOTAL_SUB = invoice.Grandtotal.ToString();

                row.LEDGER = CLedger_exten.GetName_Id(invoice.Ledger_id);

                if (invoice.Additional != 0)
                {
                    row.ADDITIONAL = invoice.Additional.ToString();
                }
                else
                {
                    row.ADDITIONAL = "";
                }

                row.ROUNDS   = invoice.Rounds.ToString();
                row.GSTTOTAL = invoice.Gsttotal.ToString();

                row.GRANDTOTAL      = invoice.Grandtotal.ToString();
                row.AMOUNT_IN_WORDS = "Rupees : " + Global.AmountInWords(invoice.Grandtotal);
                row.NOTES           = invoice.Notes;
                row.ENTRY_BY        = invoice.User_id;

                row.FORSIGN = company.Display_name;

                if (Customised.InvoiceWithBankDetails)
                {
                    row.ACCOUNT_NO = "A/C NO          :  " + cmpbank.Account_number;
                    row.IFSC_CODE  = "IFSC CODE    :  " + cmpbank.Ifsc_code;
                    row.BANK_NAME  = "BANK NAME  :  " + cmpbank.Company_bank_name;
                    row.BRANCH     = "BRANCH        :  " + cmpbank.Branch_name;
                }
                else
                {
                    row.ACCOUNT_NO = "";
                    row.IFSC_CODE  = "";
                    row.BANK_NAME  = "";
                    row.BRANCH     = "";
                }

                row.TERMS_1 = Message.TERMS_1;
                row.TERMS_2 = Message.TERMS_2;
                row.TERMS_3 = Message.TERMS_3;
                row.TERMS_4 = Customised.Terms_4;

                list.Add(row);
            }

            return(list);
        }