コード例 #1
0
ファイル: DeclareVat.ascx.cs プロジェクト: ewin66/dev
        protected void cboLegalInvoiceArtifactType_ItemRequestedByValue(object source, ListEditItemRequestedByValueEventArgs e)
        {
            ASPxComboBox comboItemUnit = source as ASPxComboBox;

            try
            {
                NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType obj = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(Guid.Parse(e.Value.ToString()));

                if (obj != null)
                {
                    comboItemUnit.DataSource = new NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType[] { obj };
                    comboItemUnit.DataBindItems();
                }
            }
            catch
            {
            }
        }
コード例 #2
0
ファイル: DeclareVat.ascx.cs プロジェクト: ewin66/dev
        protected void cpDeclareVat_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[]         para = e.Parameter.Split('|');
            CriteriaOperator filter;

            switch (para[0])
            {
            case "show":
                cboItem.Text = "";
                bill         = session.GetObjectByKey <Bill>(Guid.Parse(para[1]));

                if (bill != null)
                {
                    filter = new BinaryOperator("BillId.BillId", bill.BillId, BinaryOperatorType.Equal);
                    SaleInvoiceArtiface saleInvoiceArtiface = session.FindObject <SaleInvoiceArtiface>(filter);

                    if (saleInvoiceArtiface != null)
                    {
                        cboLegalInvoiceArtifactType.Value = saleInvoiceArtiface.LegalInvoiceArtifactTypeId.LegalInvoiceArtifactTypeId;
                        txtIssuedArtifactCode.Text        = saleInvoiceArtiface.IssuedArtifaceCode;
                        txtSeriesNumber.Text = saleInvoiceArtiface.SeriesNumber;
                    }
                    else
                    {
                        cboLegalInvoiceArtifactType.Value = null;
                        txtIssuedArtifactCode.Text        = "";
                        txtSeriesNumber.Text = "";
                    }

                    filter       = new BinaryOperator("BillId.BillId", Guid.Parse(para[1]), BinaryOperatorType.Equal);
                    billTaxClaim = session.FindObject <BillTaxClaim>(filter);

                    if (billTaxClaim != null)
                    {
                        filter = new BinaryOperator("Name", billTaxClaim.ClaimItem, BinaryOperatorType.Equal);
                        Item item = session.FindObject <Item>(filter);

                        if (item != null)
                        {
                            cboItem.Value = item.ItemId;
                        }

                        txtDescription.Text = billTaxClaim.Comment;
                    }
                    else
                    {
                        switch (bill.PaymentTerm)
                        {
                        case 1:
                            txtDescription.Text = "Tiền mặt";
                            break;

                        case 2:
                            txtDescription.Text = "Chuyển khoản";
                            break;

                        default:
                            txtDescription.Text = "";
                            break;
                        }
                    }

                    if (bill is SalesInvoice)
                    {
                        m_VatType = Constant.VAT_OUT;
                    }
                    else if (bill is PurchaseInvoice)
                    {
                        m_VatType = Constant.VAT_IN;
                    }

                    //Bill salesInvoice = session.GetObjectByKey<SalesInvoice>(bill.BillId);
                    //m_VatType = Constant.VAT_OUT;
                    //if (salesInvoice == null)
                    //{
                    //    m_VatType = Constant.VAT_IN;
                    //}

                    BindData(bill);
                }

                break;

            case "declare":

                filter = new BinaryOperator("BillId", Guid.Parse(para[1]), BinaryOperatorType.Equal);
                bill   = session.GetObjectByKey <Bill>(Guid.Parse(para[1]));

                if (bill != null)
                {
                    filter       = new BinaryOperator("BillId.BillId", Guid.Parse(para[1]), BinaryOperatorType.Equal);
                    billTaxClaim = session.FindObject <BillTaxClaim>(filter);
                    if (billTaxClaim == null)
                    {
                        billTaxClaim            = new BillTaxClaim(session);
                        billTaxClaim.BillId     = bill;
                        billTaxClaim.CreateDate = bill.IssuedDate;
                        billTaxClaim.RowStatus  = 1;
                        bill.TaxClaimStatus     = Constant.VAT_YES_DECLARE;
                    }

                    billTaxClaim.ClaimItem = cboItem.Text;
                    var taxPercentageList = BillBOBase.GetDistinctTaxPercentageList(bill.BillId);
                    if (taxPercentageList == null || taxPercentageList.Count() == 0)
                    {
                        billTaxClaim.TaxInPercentage = 0;
                    }
                    else
                    {
                        billTaxClaim.TaxInPercentage = taxPercentageList.First().Percentage;
                    }
                    //billTaxClaim.TaxInPercentage = bill.BillItems[0].BillItemTaxs[0].TaxInPercentage;
                    billTaxClaim.Amount = bill.SumOfItemPrice - bill.SumOfPromotion;
                    //billTaxClaim.TaxInNumber = billTaxClaim.Amount * billTaxClaim.TaxInPercentage / 100;
                    billTaxClaim.TaxInNumber    = bill.SumOfTax;
                    billTaxClaim.Comment        = txtDescription.Text;
                    billTaxClaim.LastUpdateDate = DateTime.Now;
                    billTaxClaim.CreateDate     = bill.IssuedDate;

                    billTaxClaim.Save();

                    filter = new BinaryOperator("BillId.BillId", bill.BillId, BinaryOperatorType.Equal);
                    SaleInvoiceArtiface saleInvoiceArtiface = session.FindObject <SaleInvoiceArtiface>(filter);
                    if (saleInvoiceArtiface == null)
                    {
                        saleInvoiceArtiface = new SaleInvoiceArtiface(session);
                        saleInvoiceArtiface.SaleInvoiceArtifaceId = Guid.NewGuid();
                        saleInvoiceArtiface.RowStatus             = 1;
                        saleInvoiceArtiface.BillId = bill;
                    }

                    NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType legalInvoiceArtifactType = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(Guid.Parse(cboLegalInvoiceArtifactType.Value.ToString()));
                    if (legalInvoiceArtifactType != null)
                    {
                        saleInvoiceArtiface.LegalInvoiceArtifactTypeId = legalInvoiceArtifactType;
                    }

                    saleInvoiceArtiface.SeriesNumber       = txtSeriesNumber.Text;
                    saleInvoiceArtiface.IssuedArtifaceCode = txtIssuedArtifactCode.Text;

                    saleInvoiceArtiface.Save();

                    //SalesInvoice salesInvoice = session.GetObjectByKey<SalesInvoice>(bill.BillId);
                    //m_VatType = Constant.VAT_OUT;
                    //if (salesInvoice == null)
                    //{
                    //    m_VatType = Constant.VAT_IN;
                    //}

                    if (bill is SalesInvoice)
                    {
                        m_VatType = Constant.VAT_OUT;
                    }
                    else if (bill is PurchaseInvoice)
                    {
                        m_VatType = Constant.VAT_IN;
                    }

                    BindData(bill);

                    cpDeclareVat.JSProperties.Add("cpDisableAccept", "Disable");
                }

                break;
            }
        }
コード例 #3
0
 public void CRUD_LegalInvoiceArtifact_Editing()
 {
     try
     {
         #region load LegalInvoiceArtifact
         NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact     legalInvoiceArtifact_ID = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact>(LegalInvoiceArtifactId);
         NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType artifactType_code       = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(Guid.Parse(legalInvoiceArtifact_ID.LegalInvoiceArtifactTypeId.LegalInvoiceArtifactTypeId.ToString()));
         if (artifactType_code == null)
         {
             throw new Exception("LegalInvoiceArtifactType is not exist system");
         }
         txt_Code_Artifact.Text       = legalInvoiceArtifact_ID.Code;
         txt_IssuedDate_Artifact.Date = legalInvoiceArtifact_ID.IssuedDate;
         cbo_Code_ArtifactType.Text   = artifactType_code.Code;
         #endregion
         #region load LegalInvoiceArtifactIdentifier
         string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" };
         for (int i = 0; i < Identifier_name.Length; i++)
         {
             LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]);
             LegalInvoiceArtifactIdentifier     identifier     = BO.get_LegalInvoiceArtifactIdentifier(session, LegalInvoiceArtifactId, identifiertype.LegalInvoiceArtifactIdentifierTypeId, Utility.Constant.ROWSTATUS_ACTIVE.ToString());
             if (identifiertype != null && identifier.LegalInvoiceArtifactId.LegalInvoiceArtifactId.Equals(LegalInvoiceArtifactId))
             {
                 if (Identifier_name[i].Equals("TEMPLATE"))
                 {
                     txt_Template_Identifier.Text = identifier.Identifier;
                 }
                 if (Identifier_name[i].Equals("SERIES"))
                 {
                     txt_Series_Identifier.Text = identifier.Identifier;
                 }
                 if (Identifier_name[i].Equals("NUMBER"))
                 {
                     txt_Number_Identifier.Text = identifier.Identifier;
                 }
             }
         }
         #endregion
         #region load LegalInvoiceArtifactOrgActor
         string[] orgActorType = { "S", "B" };
         for (int i = 0; i < orgActorType.Length; i++)
         {
             LegalInvoiceArtifactOrgActor orgActor = BO.get_OrgActorId(session, LegalInvoiceArtifactId, orgActorType[i], Utility.Constant.ROWSTATUS_ACTIVE.ToString());
             if (orgActorType[i].Equals("S"))
             {
                 cbo_Code_sell_Organization.Text      = orgActor.Code;
                 txt_AccountNumber_sell_OrgActor.Text = orgActor.AccountNumber;
                 txt_TaxCode_sell_OrgActor.Text       = orgActor.TaxCode;
                 txt_PhoneFax_sell_OrgActor.Text      = orgActor.TelephoneFax;
                 memo_Address_sell_OrgActor.Text      = orgActor.Address;
             }
             else
             {
                 cbo_Code_buy_Organization.Text      = orgActor.Code;
                 txt_AccountNumber_buy_OrgActor.Text = orgActor.AccountNumber;
                 txt_Name_buy_OrgActor.Text          = orgActor.Name;
                 txt_TaxCode_buy_OrgActor.Text       = orgActor.TaxCode;
                 txt_Description_buy_OrgActor.Text   = orgActor.Description;
                 memo_Address_buy_OrgActor.Text      = orgActor.Address;
                 txt_TelephoneFax_buy_OrgActor.Text  = orgActor.TelephoneFax;
             }
         }
         #endregion
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #4
0
        public void CRUD_LegalInvoiceArtifact_Saving()
        {
            try
            {
                string rowstatus = Utility.Constant.ROWSTATUS_ACTIVE.ToString();
                if (GUIContext.State is LegalInvoiceArtifact_Creating)
                {
                    rowstatus = Utility.Constant.ROWSTATUS_TEMP.ToString();
                }

                #region Hoa don GTGT

                NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact     artifact       = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact>(LegalInvoiceArtifactId);
                NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType artifactTypeId = BO.get_LegalInvoiceArtifactTypeId(session, cbo_Code_ArtifactType.Text.ToString(), Utility.Constant.ROWSTATUS_ACTIVE.ToString());
                if (artifact == null)
                {
                    throw new Exception("LegalInvoiceArtifactId is not exist System");
                }

                artifact.LegalInvoiceArtifactTypeId = artifactTypeId;
                artifact.Code           = txt_Code_Artifact.Text;
                artifact.IssuedDate     = DateTime.Parse(txt_IssuedDate_Artifact.Text);
                artifact.RowStatus      = Utility.Constant.ROWSTATUS_ACTIVE;
                artifact.LastUpdateDate = DateTime.Now;
                session.CommitTransaction(); //save

                string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" };
                for (int i = 0; i < Identifier_name.Length; i++)
                {
                    LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]);
                    LegalInvoiceArtifactIdentifier     identifier     = BO.get_LegalInvoiceArtifactIdentifier(session, LegalInvoiceArtifactId, identifiertype.LegalInvoiceArtifactIdentifierTypeId, rowstatus);
                    if (identifiertype != null && identifier.LegalInvoiceArtifactId.LegalInvoiceArtifactId.Equals(LegalInvoiceArtifactId))
                    {
                        if (Identifier_name[i].Equals("TEMPLATE"))
                        {
                            identifier.Identifier = txt_Template_Identifier.Text;
                        }
                        if (Identifier_name[i].Equals("SERIES"))
                        {
                            identifier.Identifier = txt_Series_Identifier.Text;
                        }
                        if (Identifier_name[i].Equals("NUMBER"))
                        {
                            identifier.Identifier = txt_Number_Identifier.Text;
                        }
                        identifier.LegalInvoiceArtifactIdentifierTypeId = identifiertype; //identifierTypeID
                        if (!rowstatus.Equals(Utility.Constant.ROWSTATUS_ACTIVE.ToString()))
                        {
                            identifier.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; //RowStatus
                        }
                        session.CommitTransaction();                                  //save
                    }
                }
                #endregion

                #region Thong tin ban
                string[] orgActorType = { "S", "B" };
                for (int i = 0; i < orgActorType.Length; i++)
                {
                    LegalInvoiceArtifactOrgActor orgActor = BO.get_OrgActorId(session, LegalInvoiceArtifactId, orgActorType[i], rowstatus);
                    Organization Organization             = BO.get_OrganizationId(session, cbo_Code_buy_Organization.Text.ToString());

                    if (orgActorType[i].Equals("S"))
                    {
                        Organization           = BO.get_OrganizationId(session, cbo_Code_sell_Organization.Text.ToString());
                        orgActor.Code          = Organization.Code;
                        orgActor.AccountNumber = txt_AccountNumber_sell_OrgActor.Text;
                        orgActor.TaxCode       = txt_TaxCode_sell_OrgActor.Text;
                        orgActor.Address       = memo_Address_sell_OrgActor.Text;
                        orgActor.TelephoneFax  = txt_PhoneFax_sell_OrgActor.Text;
                        orgActor.RowStatus     = Utility.Constant.ROWSTATUS_ACTIVE;
                    }
                    else
                    {
                        orgActor.Code          = Organization.Code;
                        orgActor.AccountNumber = txt_AccountNumber_buy_OrgActor.Text;
                        orgActor.TaxCode       = txt_TaxCode_buy_OrgActor.Text;
                        orgActor.Address       = memo_Address_buy_OrgActor.Text;
                        orgActor.TelephoneFax  = txt_TelephoneFax_buy_OrgActor.Text;
                        orgActor.Description   = txt_Description_buy_OrgActor.Text;
                        orgActor.Name          = txt_Name_buy_OrgActor.Text;
                    }
                    session.CommitTransaction();   //save
                }
                #endregion

                #region thanh toan

                #endregion

                #region don vi tham gia
                #endregion

                using_state = "";
            }
            catch (Exception)
            {
                throw;
            }
        }