Ejemplo n.º 1
0
 public FrmEmpleado(XPCollection xpcEmpleado, XPCollection xpcDepartamento, XPCollection xpcTipoNomina,XPCollection xpcPuesto,XPCollection xpcTipoEmpleado,XPCollection xpcGrupoEmpleado, XPCollection xpcPercepcion, XPCollection xpcDeduccion,XPCollection xpcConcepto,XPCollection xpcCuentaContable, UnitOfWork uow)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcEmpleado = xpcEmpleado;
     this.xpcEmpleado.Session = uow;
     this.xpcDepartamento=xpcDepartamento;
     this.xpcTipoNomina=xpcTipoNomina;
     this.xpcPuesto=xpcPuesto;
     this.xpcTipoEmpleado=xpcTipoEmpleado;
     this.xpcGrupoEmpleado = xpcGrupoEmpleado;
     this.xpcDepartamento.Session = uow;
     this.xpcTipoNomina.Session = uow;
     this.xpcPuesto.Session = uow;
     this.xpcTipoEmpleado.Session = uow;
     this.xpcGrupoEmpleado.Session = uow;
     this.xpcPercepcion = xpcPercepcion;
     this.xpcPercepcion.Session = uow;
     this.xpcDeduccion = xpcDeduccion;
     this.xpcDeduccion.Session = uow;
     this.xpcConcepto = xpcConcepto;
     this.xpcConcepto.Session = uow;
     this.xpcCuentaContable = xpcCuentaContable;
     this.xpcCuentaContable.Session = uow;
     RecargarColecciones();
     gridEmpleado.DataSource = this.xpcEmpleado;
     UpdateMenu();
     grdEmpleado.Columns.Clear();
     grdEmpleado.Columns.AddVisible("Oid");
     grdEmpleado.Columns.AddVisible("ApellidoPaterno");
     grdEmpleado.Columns.AddVisible("ApellidoMaterno");
     grdEmpleado.Columns.AddVisible("Nombre");
     grdEmpleado.BestFitColumns();
     RefreshGrid();
 }
Ejemplo n.º 2
0
 public FrmCrearTipoNomina(TipoNomina tiponomina, XPCollection xpcTipoNomina, UnitOfWork uow)
     : this()
 {
     this.TipoNomina = tiponomina;
     this.uow = uow;
     this.xpcTipoNomina = xpcTipoNomina;
 }
Ejemplo n.º 3
0
 public FrmCrearTipoEmpleado(TipoEmpleado tipoempleado, XPCollection xpcTipoEmpleado, UnitOfWork uow)
     : this()
 {
     this.TipoEmpleado = tipoempleado;
     this.uow = uow;
     this.xpcTipoEmpleado = xpcTipoEmpleado;
 }
Ejemplo n.º 4
0
        void SynchronizeTypes(UnitOfWork unitOfWork) {
            var xpObjectTypes = new XPCollection<XPObjectType>(unitOfWork);
            var dataStoreManager = new SqlMultiDataStoreProxy(ConnectionString);
            foreach (var xpObjectType in xpObjectTypes) {
                var type = ReflectionHelper.FindType(xpObjectType.TypeName);
                if (type != null) {
                    var connectionString = dataStoreManager.DataStoreManager.GetConnectionString(type);
                    var sqlDataStoreProxy = new SqlDataStoreProxy(connectionString);
                    var xpoObjectHacker = new XpoObjectHacker();
                    XPObjectType type1 = xpObjectType;
                    var simpleDataLayer = new SimpleDataLayer(sqlDataStoreProxy);
                    var session = new Session(simpleDataLayer);
                    bool sync = false;
                    sqlDataStoreProxy.DataStoreModifyData += (sender, args) => {
                        var insertStatement = args.ModificationStatements.OfType<InsertStatement>().Where(statement => statement.TableName == typeof(XPObjectType).Name).SingleOrDefault();
                        if (insertStatement != null && !sync) {
                            sync = true;
                            xpoObjectHacker.CreateObjectTypeIndetifier(insertStatement, simpleDataLayer, type1.Oid);
                            ModificationResult modificationResult = sqlDataStoreProxy.ModifyData(insertStatement);
                            args.ModificationResult = modificationResult;
                            args.ModificationResult.Identities = new[] { new ParameterValue { Value = type1.Oid }, };
                        }
                    };

                    if (session.FindObject<XPObjectType>(objectType => objectType.TypeName == type1.TypeName) == null) {
                        var objectType = new XPObjectType(session, xpObjectType.AssemblyName, xpObjectType.TypeName);
                        session.Save(objectType);

                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void frmShipmentFromWH_Load(object sender, EventArgs e)
        {
            session = new Session();
            XPCollection<Customer> customers = new XPCollection<Customer>(session);
            cboCustomer.Properties.DataSource = customers;

            if (customers.Count > 0)
                cboCustomer.EditValue = customers[0].Oid;

            XPCollection<WareHouse> warehouses = new XPCollection<WareHouse>(session);
            lueWarehouse.Properties.DataSource = warehouses;

            if (warehouses.Count > 0)
                lueWarehouse.EditValue = warehouses[0].Oid;

            cboSortBy.Properties.Items.Add("先交期, 后优先");
            cboSortBy.Properties.Items.Add("先优先, 后交期");

            sSetting = ShipmentSetting.GetInstance(session);
            fromWH = new Shipment_FromWH();
            dateLastNeedDate.DateTime = DateTime.Today.AddDays(sSetting.NoOfDay);

            if (sSetting.SortBy == ShipmentSetting.SortType.DatePriority)
                cboSortBy.SelectedIndex = 0;
            else
                cboSortBy.SelectedIndex = 1;

            chkSSTK.Checked = sSetting.IncludeSSTK;
        }
Ejemplo n.º 6
0
 void AssignCategory(RFCategory goodRfCategory, RFCategory veryGoodRfCategory, RFCategory bestRfCategory, RFCategory badRfCategory) {
     var session = ((ObjectSpace)ObjectSpace).Session;
     var customers = new XPCollection<RFCustomer>(session);
     for (int i = 0; i < customers.Count; i++) {
         switch (i) {
             case 0:
                 customers[i].Category = goodRfCategory;
                 break;
             case 1:
                 customers[i].Category = veryGoodRfCategory;
                 break;
             case 2:
                 customers[i].Category = bestRfCategory;
                 break;
             case 3:
                 customers[i].Category = badRfCategory;
                 break;
             case 4:
                 customers[i].Category = goodRfCategory;
                 break;
             case 5:
                 customers[i].Category = veryGoodRfCategory;
                 break;
             case 6:
                 customers[i].Category = bestRfCategory;
                 break;
         }
     }
 }
Ejemplo n.º 7
0
        public decimal GetAverageTurnOverMonthByYearBySupplier(int year, Supplier supplier)
        {
            Decimal cost = 0;
            try
            {
                DateTime minValue = new DateTime(year, 1, 1);
                DateTime maxValue = new DateTime(year, 12, 31);
                XPCollection<Cost> costs = new XPCollection<Cost>(uow, Cost.Fields.tas_TNR_SUPPLIER == supplier
                                                                            & Cost.Fields.Date >= minValue & Cost.Fields.Date <= maxValue);

                decimal months = 1;
                if (minValue.Year == DateTime.Now.Year)
                    months = Math.Round(Convert.ToDecimal(System.DateTime.Now.Subtract(minValue).TotalDays) / Convert.ToDecimal(30.5), 0);
                else
                    months = 12;

                cost = costs.Sum(q => q.PurchaseAmount) / months;
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return cost;
        }
Ejemplo n.º 8
0
 public FrmCrearCuentaContable(CuentaContable cuentacontable, XPCollection xpcCuentaContable, UnitOfWork uow)
     : this()
 {
     this.CuentaContable = cuentacontable;
     this.uow = uow;
     this.xpcCuentaContable = xpcCuentaContable;
 }
Ejemplo n.º 9
0
 public FrmCrearGrupoEmpleado(GrupoEmpleado grupoempleado, XPCollection xpcGrupoEmpleado, UnitOfWork uow)
     : this()
 {
     this.GrupoEmpleado = grupoempleado;
     this.uow = uow;
     this.xpcGrupoEmpleado = xpcGrupoEmpleado;
 }
Ejemplo n.º 10
0
        private void btnCreateProdOrderPickList_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.CurrentObject == null)
                return;

            XPObjectSpace objectSpace = (XPObjectSpace)Application.CreateObjectSpace();

            ProdBom pBom = (ProdBom)View.CurrentObject;
            XPCollection<ProdBom> prodBoms = new XPCollection<ProdBom>(objectSpace.Session);
            prodBoms.Criteria = DevExpress.Data.Filtering.CriteriaOperator.Parse(string.Format("Oid = '{0}'", pBom.Oid));

            ProdBom prodBom = prodBoms[0];
            ProdOrder pOrder = prodBom.ProdOrder;
            ProdOrderStart prodOrderStart = pOrder.GetLastProdOrderStart();
            ProdOrderPickList pickList = objectSpace.CreateObject<ProdOrderPickList>();
            pickList.ProdBom = prodBom;
            pickList.ProdOrderStart = prodOrderStart;
            pickList.PickQty = pickList.RecommendQty;

            e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, pickList);
            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
            e.ShowViewParameters.Context = TemplateContext.PopupWindow;
            e.ShowViewParameters.CreateAllControllers = true;

            DialogController dialogController = new DialogController();
            e.ShowViewParameters.Controllers.Add(dialogController);
        }
Ejemplo n.º 11
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            session = new Session();
            ProdOrder prodOrder;

            txtProdOrderNo.Text = txtProdOrderNo.Text.Trim().ToUpper();
            prodOrder = session.FindObject<ProdOrder>(new BinaryOperator("OrderNo", txtProdOrderNo.Text));

            if (prodOrder == null)
            {
                XtraMessageBox.Show(string.Format("找不到此生产单号 {0} !!", txtProdOrderNo.Text));
                clear();
                return;
            }

            txtItemNo.Text = prodOrder.Item.ItemNo;
            txtItemName.Text = prodOrder.Item.ItemName;
            txtItemType.Text = prodOrder.Item.ItemType.ItemTypeName;
            txtStartQty.Text = prodOrder.StartQty.ToString();
            txtFinishQty.Text = prodOrder.FinishQty.ToString();
            txtWipQty.Text = prodOrder.WipQty.ToString();

            prodBomReturns = this.GetProdBomReturnIList(prodOrder);
            gridProdOrderReturList.DataSource = prodBomReturns;

            XPCollection<WareHouse> wareHouses = new XPCollection<WareHouse>(session);
            lookupWarehouse.DataSource = wareHouses;
            lookupWarehouse.ValueMember = "This";
            lookupWarehouse.DisplayMember = "WarehouseName";
            btnPost.Enabled = true;
        }
Ejemplo n.º 12
0
 public FrmCrearSubsidio(Subsidio subsidio, XPCollection xpcSubsidio, UnitOfWork uow)
     : this()
 {
     this.Subsidio = subsidio;
     this.uow = uow;
     this.xpcSubsidio = xpcSubsidio;
 }
Ejemplo n.º 13
0
 public FrmCrearPuesto(Puesto puesto, XPCollection xpcPuesto, UnitOfWork uow)
     : this()
 {
     this.Puesto = puesto;
     this.uow = uow;
     this.xpcPuesto = xpcPuesto;
 }
Ejemplo n.º 14
0
 private void btnAsignar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     PercepcionBase percepcionbase = ((PercepcionBase)xpcPercepcionBase[grdPercepcionBase.FocusedRowHandle]);
     XPCollection xpcPercepcionBaseAnidada = new XPCollection(uowAnidada, xpcPercepcionBase, new GroupOperator(GroupOperatorType.And, new BinaryOperator("This", percepcionbase, BinaryOperatorType.Equal)));
     if (xpcPercepcionBaseAnidada.Count != 0)
     {
         PercepcionBase percepcionbase1 = (PercepcionBase)(xpcPercepcionBaseAnidada[0]);
         xpcConceptoDetalleAnidada.Filter = new GroupOperator(GroupOperatorType.And, new BinaryOperator("PercepcionBase", percepcionbase1, BinaryOperatorType.Equal),
             new BinaryOperator("Concepto", concepto, BinaryOperatorType.Equal));
         if (xpcConceptoDetalleAnidada.Count == 0)
         {
             ConceptoDetalle conceptodetalle = new ConceptoDetalle(uowAnidada);
             conceptodetalle.Concepto = concepto;
             conceptodetalle.PercepcionBase = percepcionbase1;
             //                conceptodetalle.Save();
             xpcConceptoDetalleAnidada.Add(conceptodetalle);
             xpcConceptoDetalleAnidada.Filter = new GroupOperator(GroupOperatorType.And, new BinaryOperator("Concepto", concepto, BinaryOperatorType.Equal));
             Close();
         }
         else
         {
             XtraMessageBox.Show("La Percepcion Base ya Esta Incluida en el Concepto", "Percepcion Base ya Incluida", MessageBoxButtons.OK, MessageBoxIcon.Error);
             xpcConceptoDetalleAnidada.Filter = new GroupOperator(GroupOperatorType.And, new BinaryOperator("Concepto", concepto, BinaryOperatorType.Equal));
             Close();
         }
     }
 }
Ejemplo n.º 15
0
 public FrmCrearImpuesto(Impuesto impuesto, XPCollection xpcImpuesto, UnitOfWork uow)
     : this()
 {
     InitializeComponent();
     this.Impuesto = impuesto;
     this.uow = uow;
     this.xpcImpuesto = xpcImpuesto;
 }
        protected override void OnActivated()
        {
            base.OnActivated();

            subjectAreaCollection = ObjectSpace.CreateObject<XPCollection<SubjectArea>>();
            subjectAreaCollection.Load();

            PopulateSubjectAreaList();
        }
Ejemplo n.º 17
0
 public void SynchronizeTypes( string connectionString) {
     var types = new XPCollection<XPObjectType>(new Session { ConnectionString = connectionString });
     var xpObjectTypes = types.ToList().Where(objectType => ReflectionHelper.FindType(objectType.TypeName) != null);
     var sqlMultiDataStoreProxy = new SqlMultiDataStoreProxy(connectionString);
     foreach (var connstring in GetConnectionStrings(sqlMultiDataStoreProxy.DataStoreManager, xpObjectTypes,connectionString)) {
         if (connstring!=connectionString) {
             SynchronizeTypes(connstring, xpObjectTypes);
         }
     }
 }
Ejemplo n.º 18
0
 protected override void OnChanged(string propertyName, object oldValue, object newValue) {
     base.OnChanged(propertyName, oldValue, newValue);
     if (propertyName == "ConnectionString") {
         try {
             _dataTables = new XPCollection<DataTable>(Session, GetStorageTables());
         } catch (UnableToOpenDatabaseException) {
         }
         OnChanged("DataTables");
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 检索消费备注项目列表
        /// </summary>
        /// <returns></returns>
        public XPCollection<t_Consume_Content> SearchConsumItems()
        {
            GroupOperator groupCriteria = new GroupOperator(
                GroupOperatorType.And,
                new BinaryOperator("State", 0, BinaryOperatorType.Equal)
            );

            XPCollection<t_Consume_Content> res = new XPCollection<t_Consume_Content>(theCriteria: groupCriteria);
            return res;
        }
Ejemplo n.º 20
0
 public FrmCuentaContable(XPCollection xpcCuentaContable, UnitOfWork uow)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcCuentaContable = xpcCuentaContable;
     this.xpcCuentaContable.Session = uow;
     RecargarColecciones();
     gridCuentaContable.DataSource = this.xpcCuentaContable;
     UpdateMenu();
     RefreshGrid();
 }
Ejemplo n.º 21
0
 public FrmSubsidio(XPCollection xpcSubsidio, UnitOfWork uow)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcSubsidio = xpcSubsidio;
     this.xpcSubsidio.Session = uow;
     RecargarColecciones();
     grdSubsidio.DataSource = this.xpcSubsidio;
     UpdateMenu();
     RefreshGrid();
 }
Ejemplo n.º 22
0
        public XPCollection<t_Product_Info> SearchProductList()
        {
            GroupOperator groupCriteria = new GroupOperator(
                GroupOperatorType.And,
                new BinaryOperator("State", 0, BinaryOperatorType.Equal)
            );

            XPCollection<t_Product_Info> res = new XPCollection<t_Product_Info>(theCriteria: groupCriteria);

            return res;
        }
Ejemplo n.º 23
0
 public FrmTipoNomina(XPCollection xpcTipoNomina, UnitOfWork uow)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcTipoNomina = xpcTipoNomina;
     this.xpcTipoNomina.Session = uow;
     RecargarColecciones();
     gridTipoNomina.DataSource = this.xpcTipoNomina;
     UpdateMenu();
     RefreshGrid();
 }
Ejemplo n.º 24
0
 public FrmGrupoEmpleado(XPCollection xpcGrupoEmpleado, UnitOfWork uow)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcGrupoEmpleado = xpcGrupoEmpleado;
     this.xpcGrupoEmpleado.Session = uow;
     RecargarColecciones();
     gridGrupoEmpleado.DataSource = this.xpcGrupoEmpleado;
     UpdateMenu();
     RefreshGrid();
 }
Ejemplo n.º 25
0
 public void AddDynamicModules(ApplicationModulesManager moduleManager, UnitOfWork unitOfWork){
     Type assemblyInfoType = TypesInfo.Instance.PersistentAssemblyInfoType;
     List<IPersistentAssemblyInfo> persistentAssemblyInfos =
         new XPCollection(unitOfWork, assemblyInfoType).Cast<IPersistentAssemblyInfo>().Where(info => !info.DoNotCompile &&
             moduleManager.Modules.Where(@base => @base.Name == "Dynamic" + info.Name + "Module").FirstOrDefault() ==null).ToList();
     _definedModules = new CompileEngine().CompileModules(persistentAssemblyInfos,GetPath());
     foreach (var definedModule in _definedModules){
         moduleManager.AddModule(definedModule);
     }
     unitOfWork.CommitChanges();
 }
Ejemplo n.º 26
0
 public void MergeTypes(UnitOfWork unitOfWork, List<Type> persistentTypes, IDbCommand command)
 {
     var collection = new XPCollection(unitOfWork, WCTypesInfo.Instance.FindBussinessObjectType<IPersistentClassInfo>()).Cast<IPersistentClassInfo>().Where(info => info.MergedObjectFullName != null).ToList();
     foreach (IPersistentClassInfo classInfo in collection){
         XPClassInfo xpClassInfo = getClassInfo(classInfo.Session,classInfo.PersistentAssemblyInfo.Name+"."+ classInfo.Name,persistentTypes);
         var mergedXPClassInfo = getClassInfo(classInfo.Session, classInfo.MergedObjectFullName, persistentTypes) ?? classInfo.Session.GetClassInfo(ReflectionHelper.GetType(classInfo.MergedObjectFullName));
         if (xpClassInfo != null) {
             unitOfWork.UpdateSchema(xpClassInfo.ClassType, mergedXPClassInfo.ClassType);
             updateObjectType(unitOfWork, xpClassInfo, mergedXPClassInfo,command);
         }
     }
 }
Ejemplo n.º 27
0
        public Planning GetPlanning(Guid dispatcher)
        {
            var planning = new XPCollection<Planning>(this.Session);
            var result = (from Planning plan in planning
                where plan.Dispatcher == dispatcher
                select plan).ToList();

            if (result.Count > 0)
                return result[0];

            return null;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 获得店铺列表
        /// </summary>
        /// <returns>XPCollection</returns>
        public XPCollection<t_Shopping_Guide> GetGuideList()
        {
            // 拼接查询条件
            GroupOperator groupCriteria = new GroupOperator(
                GroupOperatorType.And,
                new BinaryOperator("State", RecordState.Normal, BinaryOperatorType.Equal)
                );
            // 根据条件查询店铺列表
            XPCollection<t_Shopping_Guide> xpGuideList = new XPCollection<t_Shopping_Guide>(theCriteria: groupCriteria);

            // 返回查询结果
            return xpGuideList;
        }
Ejemplo n.º 29
0
 public FrmDepartamento(XPCollection xpcDepartamento, UnitOfWork uow,XPCollection xpcCuentaContable)
 {
     InitializeComponent();
     this.uow = uow;
     this.xpcDepartamento = xpcDepartamento;
     this.xpcDepartamento.Session = uow;
     this.xpcCuentaContable = xpcCuentaContable;
     this.xpcCuentaContable.Session = uow;
     RecargarColecciones();
     gridDepartamento.DataSource = this.xpcDepartamento;
     UpdateMenu();
     RefreshGrid();
 }
Ejemplo n.º 30
0
        public void GenerateComboBox()
        {
            XPCollection<Customer> customers = new XPCollection<Customer>(uow);
            SortingCollection sorting = new SortingCollection();
            sorting.Add(new SortProperty("No", DevExpress.Xpo.DB.SortingDirection.Ascending));
            customers.Sorting = sorting;

            foreach (Customer customer in customers)
            {
                cboCustomer.Properties.Items.Add(customer.No);
                dictCustomer.Add(customer.No, customer);
            }
        }
Ejemplo n.º 31
0
        //XpoMode
        public TreeViewArticle(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            //Init Vars
            Type xpoGuidObjectType = typeof(FIN_Article);
            //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView
            FIN_Article defaultValue = (pDefaultValue != null) ? pDefaultValue as FIN_Article : null;
            //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView
            Type typeDialogClass = (pDialogType != null) ? pDialogType : typeof(DialogArticle);

            //Config
            int fontGenericTreeViewColumn = Convert.ToInt16(GlobalFramework.Settings["fontGenericTreeViewColumn"]);

            //Configure columnProperties
            List <GenericTreeViewColumnProperty> columnProperties = new List <GenericTreeViewColumnProperty>();

            columnProperties.Add(new GenericTreeViewColumnProperty("Code")
            {
                Title = Resx.global_record_code, MinWidth = 100
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Designation")
            {
                Title = Resx.global_designation, Expand = true
            });
            //To Test XPGuidObject InitialValue (InitialValue = xArticleFamily) : ArticleFamily xArticleFamily = (ArticleFamily)FrameworkUtils.GetXPGuidObjectFromSession(GlobalFramework.SessionXpoBackoffice, typeof(ArticleFamily), new Guid("471d8c1e-45c1-4dbe-8526-349c20bd53ef"));
            columnProperties.Add(new GenericTreeViewColumnProperty("Family")
            {
                Title = Resx.global_article_family, ChildName = "Designation"
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("SubFamily")
            {
                Title = Resx.global_article_subfamily, ChildName = "Designation"
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Type")
            {
                Title = Resx.global_article_type, ChildName = "Designation"
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("TotalStock")
            {
                Query    = "SELECT SUM(Quantity) as Result FROM fin_articlestock WHERE Article = '{0}' AND (Disabled = 0 OR Disabled is NULL) GROUP BY Article;",
                Title    = Resx.global_total_stock,
                MinWidth = 100,
                //Alignment = 1.0F,
                FormatProvider = new FormatterDecimal(),
                //CellRenderer = new CellRendererText()
                //{
                //    FontDesc = new Pango.FontDescription() { Size = fontGenericTreeViewColumn },
                //    Alignment = Pango.Alignment.Right,
                //    Xalign = 1.0F
                //}
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("UpdatedAt")
            {
                Title = Resx.global_record_date_updated, MinWidth = 150, MaxWidth = 150
            });

            //Configure Criteria/XPCollection/Model
            //Default Criteria with XpoOidUndefinedRecord
            CriteriaOperator criteria = pXpoCriteria;

            // Override Criteria adding XpoOidHiddenRecordsFilter
            criteria = CriteriaOperator.Parse($"({pXpoCriteria.ToString()}) OR (Oid NOT LIKE '{SettingsApp.XpoOidHiddenRecordsFilter}')");
            //Custom Criteria hidding all Hidden Oids
            //CriteriaOperator criteria = CriteriaOperator.Parse($"(Oid = '{SettingsApp.XpoOidUndefinedRecord}' OR Oid NOT LIKE '{SettingsApp.XpoOidHiddenRecordsFilter}')");
            XPCollection xpoCollection = new XPCollection(GlobalFramework.SessionXpo, xpoGuidObjectType, criteria);

            //Call Base Initializer
            base.InitObject(
                pSourceWindow,                 //Pass parameter
                defaultValue,                  //Pass parameter
                pGenericTreeViewMode,          //Pass parameter
                pGenericTreeViewNavigatorMode, //Pass parameter
                columnProperties,              //Created Here
                xpoCollection,                 //Created Here
                typeDialogClass                //Created Here
                );
        }
Ejemplo n.º 32
0
        private void simpleButtonReport_Click(object sender, EventArgs e)
        {
            _AnnoInCorso = this.dateEditInizio.DateTime.Year;
            _Inizio      = this.dateEditInizio.DateTime;
            _Fine        = this.dateEditFine.DateTime;
            _Ingressi    = new List <Ingresso>();
            _List        = new List <DatiReport04>();
            _Aperture    = new GestoreAperture();

            foreach (var item in this.checkedListBoxControl1.CheckedItems)
            {
                Ingresso ingresso = item as Ingresso;
                if (ingresso != null)
                {
                    _Ingressi.Add(ingresso);
                }
            }

            if (_Ingressi.Count == 0)
            {
                XtraMessageBox.Show("Selezionare un ingresso");
                return;
            }

            if (this.dateEditFine.DateTime.Date >= DateTime.Now.Date)
            {
                XtraMessageBox.Show("Data Fine non può essere maggiore della data odierna", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Cursor saveCursor = Cursor.Current;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                InitList(_Inizio);

                _Aperture.CaricaApertureIngressi(_Inizio, _Fine, this.unitOfWork1);
                _Aperture.CaricaApertureIngressi(_Inizio.AddYears(-1), _Fine.AddYears(-1), this.unitOfWork1);
                _Aperture.CaricaApertureIngressi(_Inizio.AddYears(-2), _Fine.AddYears(-2), this.unitOfWork1);
                _Aperture.CaricaApertureIngressi(_Inizio.AddYears(-3), _Fine.AddYears(-3), this.unitOfWork1);
                _Aperture.CaricaApertureIngressi(_Inizio.AddYears(-4), _Fine.AddYears(-4), this.unitOfWork1);

                XPCollection <Vendita> vendite = new XPCollection <Vendita>(this.unitOfWork1);

                GroupOperator periodo1 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                    new BinaryOperator("DataContabile", _Inizio, BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", _Fine, BinaryOperatorType.LessOrEqual)
                });
                GroupOperator periodo2 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                    new BinaryOperator("DataContabile", _Inizio.AddYears(-1), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", _Fine.AddYears(-1), BinaryOperatorType.LessOrEqual)
                });
                GroupOperator periodo3 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                    new BinaryOperator("DataContabile", _Inizio.AddYears(-2), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", _Fine.AddYears(-2), BinaryOperatorType.LessOrEqual)
                });
                GroupOperator periodo4 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                    new BinaryOperator("DataContabile", _Inizio.AddYears(-3), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", _Fine.AddYears(-3), BinaryOperatorType.LessOrEqual)
                });
                GroupOperator periodo5 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                    new BinaryOperator("DataContabile", _Inizio.AddYears(-4), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", _Fine.AddYears(-4), BinaryOperatorType.LessOrEqual)
                });

                vendite.Criteria = new GroupOperator(GroupOperatorType.Or,
                                                     new CriteriaOperator[] { periodo1, periodo2, periodo3, periodo4, periodo5 });

                foreach (Vendita vendita in vendite)
                {
                    foreach (RigaVenditaVariante riga in vendita.RigheVenditaVariante)
                    {
                        foreach (Ingresso ingresso in riga.Variante.Biglietto.Percorso.Ingressi)
                        {
                            if (_Ingressi.Contains(ingresso))
                            {
                                AddToList(ingresso, riga.Quantita, vendita.DataContabile, riga.Variante.TipologiaEconomica, riga);
                            }
                        }
                    }
                }

                GroupOperator cardPeriodo1 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", _Inizio, BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", _Fine.AddDays(1), BinaryOperatorType.Less),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });
                GroupOperator cardPeriodo2 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", _Inizio.AddYears(-1), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", _Fine.AddYears(-1).AddDays(1), BinaryOperatorType.Less),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });
                GroupOperator cardPeriodo3 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", _Inizio.AddYears(-2), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", _Fine.AddYears(-2).AddDays(1), BinaryOperatorType.Less),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });
                GroupOperator cardPeriodo4 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", _Inizio.AddYears(-3), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", _Fine.AddYears(-3).AddDays(1), BinaryOperatorType.Less),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });
                GroupOperator cardPeriodo5 = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", _Inizio.AddYears(-4), BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", _Fine.AddYears(-4).AddDays(1), BinaryOperatorType.Less),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });

                XPCollection <Entrata> entrate = new XPCollection <Entrata>(this.unitOfWork1);
                entrate.Criteria = new GroupOperator(GroupOperatorType.Or, new CriteriaOperator[]
                {
                    cardPeriodo1, cardPeriodo2, cardPeriodo3, cardPeriodo4, cardPeriodo5
                });

                foreach (var entrata in entrate)
                {
                    if (_Ingressi.Contains(entrata.RigaStampaIngresso.Ingresso))
                    {
                        AddCardToList(entrata);
                    }
                }


                foreach (Ingresso ingresso in _Ingressi)
                {
                    AddToList(ingresso, _Aperture.TotaleGiornate(ingresso.Oid, _Inizio, _Fine), "1");
                    AddToList(ingresso, _Aperture.TotaleGiornate(ingresso.Oid, _Inizio.AddYears(-1), _Fine.AddYears(-1)), "2");
                    AddToList(ingresso, _Aperture.TotaleGiornate(ingresso.Oid, _Inizio.AddYears(-2), _Fine.AddYears(-2)), "3");
                    AddToList(ingresso, _Aperture.TotaleGiornate(ingresso.Oid, _Inizio.AddYears(-3), _Fine.AddYears(-3)), "4");
                    AddToList(ingresso, _Aperture.TotaleGiornate(ingresso.Oid, _Inizio.AddYears(-4), _Fine.AddYears(-4)), "5");
                }

                foreach (DatiReport04 dato in _List)
                {
                    dato.CalcolaTotale(_List);
                }

                XtraReport04 report = new XtraReport04();

                report.Init(_List, _Inizio, _Fine, this.memoEditInfo.Text);

                report.ShowRibbonPreviewDialog();
            }
            finally
            {
                Cursor.Current = saveCursor;
            }
        }
Ejemplo n.º 33
0
        private void TaoDuLieuTinhLuongThang()
        {
            XPCollection xpcLuongChucVu = new XPCollection(typeof(GiaTriTienLuongTheoChucVu));

            if (xpcLuongChucVu.Count == 0)
            {
                XtraMessageBox.Show("Chưa có dữ liệu lương chức vụ. Vui lòng khởi tạo dữ liệu lương chức vụ.");
                return;
            }

            xpcChamCong.Reload();
            DateTime thang = DateTime.Parse(dtThang.EditValue.ToString());

            string       str = thang.Month.ToString() + "-" + thang.Year.ToString();// Phân biệt bảng xếp ca các tháng
            XPCollection xpcChamCongTheoThang = new XPCollection(xpcChamCong, new BinaryOperator("TenBangChamCong", str, BinaryOperatorType.Equal));

            if (xpcChamCongTheoThang.Count > 0)
            {
                xpcMucTienLuong.Sorting = new SortingCollection(new SortProperty[] {
                    new SortProperty("UuTien", DevExpress.Xpo.DB.SortingDirection.Ascending)
                });
                foreach (Employee item in xpcNhanVien)
                {
                    foreach (LoaiDuLieuTinhLuong loaiDL in xpcMucTienLuong)
                    {
                        /*ChiTietTienLuong ctLuong = new ChiTietTienLuong()
                         * {
                         *  NhanVien = item,
                         *  Thang = DateTime.Parse(dtThang.EditValue.ToString()),
                         *  LoaiDLTinhLuong = loaiDL,
                         *  GiaTri = 0
                         * };
                         * if(!String.IsNullOrEmpty(loaiDL.GiaTriMacDinh))
                         * {
                         *  ctLuong.GiaTri = decimal.Parse(loaiDL.GiaTriMacDinh);
                         * }
                         * //Kiểm tra chi tiết lương đã có chưa
                         * XPCollection xpc = new XPCollection(xpcChiTietLuong, CriteriaOperator.And(
                         * new BinaryOperator("Thang", ctLuong.Thang), new BinaryOperator("NhanVien", ctLuong.NhanVien)
                         * , new BinaryOperator("LoaiDLTinhLuong", ctLuong.LoaiDLTinhLuong)));
                         * if (xpc.Count == 0)
                         * {
                         *  xpcChiTietLuong.Add(ctLuong);
                         * }
                         * else
                         * {
                         *  ChiTietTienLuong ctTemp = xpc[0] as ChiTietTienLuong;
                         *  ctTemp.GiaTri = ctLuong.GiaTri;//?
                         * }*/



                        ChiTietTienLuong ctLuong = new ChiTietTienLuong()
                        {
                            NhanVien        = item,
                            Thang           = DateTime.Parse(dtThang.EditValue.ToString()),
                            LoaiDLTinhLuong = loaiDL,
                            GiaTri          = 0
                        };
                        //Tinh Theo Gia Tri Mac Dinh
                        if (!String.IsNullOrEmpty(loaiDL.GiaTriMacDinh))
                        {
                            ctLuong.GiaTri = decimal.Parse(loaiDL.GiaTriMacDinh);
                        }

                        //Tinh Theo Chuc Vu
                        #region TÍNH LƯƠNG THEO CHỨC VỤ
                        if (ctLuong.LoaiDLTinhLuong.NhomChucVu)
                        {
                            XPCollection xpcGiaTriTheoChucVu = new XPCollection(xpcGiaTriTienLuongTheoChucVu, CriteriaOperator.And(new BinaryOperator("ChucVu", ctLuong.NhanVien.ChucVu),
                                                                                                                                   new BinaryOperator("MucTienLuong", ctLuong.LoaiDLTinhLuong)));
                            if (xpcGiaTriTheoChucVu.Count > 0)
                            {
                                GiaTriTienLuongTheoChucVu gtLuongTheoChucVu = xpcGiaTriTheoChucVu[0] as GiaTriTienLuongTheoChucVu;
                                ctLuong.GiaTri = gtLuongTheoChucVu.GiaTri == null ? 0 : gtLuongTheoChucVu.GiaTri;
                            }
                        }
                        #endregion

                        //Tinh luong theo cong thuc
                        #region TÍNH LƯƠNG THEO CÔNG THỨC
                        using (var uow = new UnitOfWork())
                        {
                            LoaiDuLieuTinhLuong temp = uow.FindObject <LoaiDuLieuTinhLuong>(CriteriaOperator.Parse("Oid = ?", ctLuong.LoaiDLTinhLuong.Oid));
                            //Kiểm tra xem loại dữ liệu tính lương này có sử dụng công thức không
                            if (!String.IsNullOrEmpty(temp.CongThuc))
                            {
                                //Công thức được định dạng chuẩn:

                                /* Cột lưu [C+số thứ tự] : C tiền tớ bắt buộc
                                 * Giá trị [Giá Trị]
                                 * VD: [C3] + [C5] * [100]*/

                                string[] congThuc = temp.CongThuc.Split('[', ']'); // "", C3, +, C10, *, 100, "" 8+10*100
                                string   bieuthuc = string.Empty;
                                for (int j = 1; j < congThuc.Length; j++)
                                {
                                    if (congThuc[j].Contains('C'))
                                    {
                                        XPCollection xpcGiatri = new XPCollection(xpcChiTietLuong, CriteriaOperator.And(
                                                                                      new BinaryOperator("Thang", ctLuong.Thang), new BinaryOperator("NhanVien", ctLuong.NhanVien)
                                                                                      , new BinaryOperator("LoaiDLTinhLuong.STT", congThuc[j].Substring(1))));
                                        if (xpcGiatri.Count > 0)
                                        {
                                            decimal temp1 = (xpcGiatri[0] as ChiTietTienLuong).GiaTri;
                                            bieuthuc += temp1;
                                        }
                                    }
                                    else
                                    {
                                        if (congThuc[j] != "")
                                        {
                                            bieuthuc += congThuc[j];
                                        }
                                    }
                                }
                                ctLuong.GiaTri = TinhBieuThucDonGian(bieuthuc);
                            }
                        }
                        #endregion


                        //Kiểm tra chi tiết lương đã có chưa
                        XPCollection xpc = new XPCollection(xpcChiTietLuong, CriteriaOperator.And(
                                                                new BinaryOperator("Thang", ctLuong.Thang), new BinaryOperator("NhanVien", ctLuong.NhanVien)
                                                                , new BinaryOperator("LoaiDLTinhLuong", ctLuong.LoaiDLTinhLuong)));
                        if (xpc.Count == 0)
                        {
                            xpcChiTietLuong.Add(ctLuong);
                        }
                        else
                        {
                            ChiTietTienLuong ctTemp = xpc[0] as ChiTietTienLuong;
                            ctTemp.GiaTri = ctLuong.GiaTri;//?
                        }
                    }
                }
            }
            XpoDefault.Session.Save(xpcChiTietLuong);
            pivotGridControl1.RefreshData();
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Инициализации определенной коллекции данных.
 /// </summary>
 public static void InitXPCollection(XPCollection collection, Type type, Session session)
 {
     collection = new XPCollection();
     XPCollectionContainer.InitXPCollection(collection, type, session);
 }
Ejemplo n.º 35
0
        public List <TFCodeTaskGenerateFee> GetListCodeTaskGenerateFees()
        {
            var xpcCodeTaskGenerateFees = new XPCollection <TFCodeTaskGenerateFee>(TheUow, CriteriaOperator.Parse("g_CodeTaskGuid = ?", g_ID));

            return(xpcCodeTaskGenerateFees.ToList());
        }
Ejemplo n.º 36
0
        public List <TRCodeRemind> GetListCodeReminds()
        {
            var xpcCodeReminds = new XPCollection <TRCodeRemind>(TheUow, CriteriaOperator.Parse("s_TriggerType = 'Task' And s_TriggerConfigID = ?", g_ID));

            return(xpcCodeReminds.ToList());
        }
Ejemplo n.º 37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ReportHiddenField.Contains("typeReport"))
            {
                XPQuery <BillTaxClaim>        billTaxClaim        = new XPQuery <BillTaxClaim>(session);
                XPQuery <Bill>                bill                = new XPQuery <Bill>(session);
                XPQuery <SaleInvoiceArtiface> saleInvoiceArtiface = new XPQuery <SaleInvoiceArtiface>(session);

                char vatType = (ReportHiddenField.Get("typeReport").ToString() == "01-1/GTGT" ? Constant.VAT_OUT : Constant.VAT_IN);

                var list = from btc in billTaxClaim.AsEnumerable()
                           join sia in saleInvoiceArtiface on btc.BillId.BillId equals sia.BillId.BillId
                           where sia.LegalInvoiceArtifactTypeId.Category == vatType
                           select new C011GTGT()
                {
                    Amount          = btc.Amount,
                    ClaimItem       = btc.ClaimItem,
                    Comment         = btc.Comment,
                    CreateDate      = btc.CreateDate,
                    TaxInNumber     = btc.TaxInNumber,
                    TaxInPercentage = btc.TaxInPercentage,
                    TotalAmount     = btc.TotalAmount,
                    BillCode        = sia.IssuedArtifaceCode,
                    SeriesNumber    = sia.SeriesNumber,
                    ObjectName      = btc.BillId.SourceOrganizationId.Name,
                    ObjectTax       = btc.BillId.SourceOrganizationId.TaxNumber,
                    LegalInvoiceArtifactTypeCode = sia.LegalInvoiceArtifactTypeId.Code,
                    LegalInvoiceArtifactTypeName = sia.LegalInvoiceArtifactTypeId.Name
                };

                List <C011GTGT> data = new List <C011GTGT>();

                try
                {
                    CriteriaOperator _filter = new GroupOperator(GroupOperatorType.And,
                                                                 new BinaryOperator("Category", vatType, BinaryOperatorType.Equal),
                                                                 new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual));
                    XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType> _legalInvoiceArtifactType = new XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(session);
                    _legalInvoiceArtifactType.Criteria = _filter;

                    var _result = list;

                    foreach (NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType liat in _legalInvoiceArtifactType)
                    {
                        if (!list.ToList().Any(l => l.LegalInvoiceArtifactTypeCode == liat.Code))
                        {
                            C011GTGT _c011GTGT = new C011GTGT()
                            {
                                Amount          = 0,
                                ClaimItem       = "",
                                Comment         = "",
                                CreateDate      = DateTime.Now,
                                TaxInNumber     = 0,
                                TaxInPercentage = 0,
                                TotalAmount     = 0,
                                BillCode        = "",
                                SeriesNumber    = "",
                                ObjectName      = "",
                                ObjectTax       = "",
                                LegalInvoiceArtifactTypeCode = liat.Code,
                                LegalInvoiceArtifactTypeName = liat.Name
                            };

                            _result = _result.Concat(new List <C011GTGT> {
                                _c011GTGT
                            });
                        }
                    }

                    data = _result.ToList();
                }
                catch
                {
                }
                if (vatType == Constant.VAT_OUT)
                {
                    _01_1_GTGT report = new _01_1_GTGT();
                    report.DataSource   = data;
                    report.DataMember   = "";
                    reportViewer.Report = report;
                }
                else
                {
                    _01_2_GTGT report = new _01_2_GTGT();
                    report.DataSource   = data;
                    report.DataMember   = "";
                    reportViewer.Report = report;
                }


                formInvoiceVatReport.JSProperties.Add("cpShowReport", "report");
            }
        }
Ejemplo n.º 38
0
        /// <summary>
        /// 绘制表格
        /// </summary>
        /// <param name="regionNode"></param>
        private void DrawGrid(TreeListNode regionNode)
        {
            int rows = int.Parse(regionNode.GetValue("RG020").ToString());              //层数
            int cols = int.Parse(regionNode.GetValue("RG021").ToString());

            gridView1.BeginUpdate();

            /////////清除所有数据
            gridTable.Clear();
            gridTable.Columns.Clear();

            gridView1.RowHeight = App_Const.GRID_HEIGHT;

            ////生成列
            DataColumn col = null;
            DataRow    row = null;

            for (int i = 1; i <= cols; i++)
            {
                col          = new DataColumn("col" + i.ToString(), typeof(string));
                col.ReadOnly = true;
                gridTable.Columns.Add(col);
            }

            CriteriaOperator    criteria  = CriteriaOperator.Parse("RG001 ='" + regionNode.GetValue("RG001").ToString() + "'");
            XPCollection <BI01> bits_arry = new XPCollection <BI01>(unitOfWork1, xpCollection_bi01, criteria);

            SortingCollection sorting = new SortingCollection();

            sorting.Add(new SortProperty("BI005", DevExpress.Xpo.DB.SortingDirection.Descending));
            sorting.Add(new SortProperty("BI008", DevExpress.Xpo.DB.SortingDirection.Ascending));
            bits_arry.Sorting = sorting;


            int bitIndex = 0;

            for (int i = 1; i <= rows; i++)
            {
                row = gridTable.NewRow();
                for (int j = 1; j <= cols; j++)
                {
                    //bits_arry[i - 1].BI003
                    row.SetField(j - 1, bits_arry[bitIndex].BI003);
                    bitIndex++;
                }
                gridTable.Rows.Add(row);
            }

            gridControl1.DataSource = gridTable;
            gridView1.PopulateColumns();

            //设置列宽
            for (int i = 1; i <= cols; i++)
            {
                gridView1.Columns[i - 1].Width = App_Const.GRID_WIDTH;
            }
            //grid标题
            TreeListNode hall_node = regionNode.ParentNode.ParentNode;
            TreeListNode room_node = regionNode.ParentNode;

            gridView1.ViewCaption = hall_node.GetDisplayText("RG003") + "-" + room_node.GetDisplayText("RG003") + "-" + regionNode.GetDisplayText("RG003");

            gridView1.EndUpdate();
        }
Ejemplo n.º 39
0
        private bool SaveChanges()
        {
            this.gridView1.CloseEditor();

            //_taskGroup.ResourceId = (this.lookUpEditIngresso.EditValue as Ingresso).Oid;
            _taskGroup.Description = this.memoEditNote.Text;
            //_taskGroup.Start = this.dateEditData.DateTime.Date + this.timeEditOra.Time.TimeOfDay;
            //_taskGroup.Finish = _task.Start.AddMinutes(30);
            //_taskGroup.Location = (this.lookUpEditIngresso.EditValue as Ingresso).Descrizione;
            _taskGroup.Subject    = this.textEditSubject.Text;
            _taskGroup.Pax        = (int)this.spinEditPersone.Value;
            _taskGroup.Anticipo   = this.spinEditAnticipo.Value;
            _taskGroup.Utilizzata = this.checkEditUtilizzata.Checked;

            foreach (var item in _taskGroup.ElencoTask)
            {
                item.Label    = atype;
                item.Finish   = item.Start.AddMinutes(30);
                item.Subject  = string.Format("{0} {1}", item.Pax, _taskGroup.Subject);
                item.Location = this.unitOfWork1.GetObjectByKey <Ingresso>(item.ResourceId).Descrizione;
            }

            atype++;
            if (atype == 11)
            {
                atype = 0;
            }

            _taskGroup.Save();

            // verifica ingressi
            foreach (var item in _taskGroup.ElencoTask)
            {
                Ingresso ingr = this.unitOfWork1.GetObjectByKey <Ingresso>(item.ResourceId);
                if (ingr.VerificaCalendario)
                {
                    GroupOperator criteria1 = new GroupOperator(GroupOperatorType.And);
                    criteria1.Operands.Add(new BinaryOperator("Ingresso.Oid", item.ResourceId));
                    criteria1.Operands.Add(new BinaryOperator("DataOra", item.Start));

                    IngressoCalendario calendario = this.unitOfWork1.FindObject <IngressoCalendario>(criteria1);
                    if (calendario != null)
                    {
                        GroupOperator criteria = new GroupOperator(GroupOperatorType.And);
                        criteria.Operands.Add(new BinaryOperator("ResourceId", item.ResourceId));
                        criteria.Operands.Add(new BinaryOperator("Start", item.Start));

                        XPCollection <Task> tcheck = new XPCollection <Task>(this.unitOfWork1, criteria);
                        tcheck.Criteria = criteria;

                        int totale = 0;
                        foreach (Task task in tcheck)
                        {
                            totale += task.Pax;
                        }
                        if (calendario.PaxMax < totale)
                        {
                            item.Status = 3;
                            item.Errore = true;
                            item.Save();
                            return(false);
                        }
                    }
                    else
                    {
                        item.Status = 3;
                        item.Errore = true;
                        item.Save();
                        return(false);
                    }
                }

                item.Status = 0;
                item.Errore = false;
                item.Save();
            }

            return(true);
        }
Ejemplo n.º 40
0
        public override List <BaseReportHelper> CreateReportListSource(Session ssn, CriteriaOperator criteria)
        {
            XPClassInfo classInfo = ssn.GetClassInfo(this.GetType());

            XPCollection <crmDebtorCreditorDebtRegister> dbRegister = new XPCollection <crmDebtorCreditorDebtRegister>(ssn, criteria, null);

            dbRegister.Criteria = criteria;
            dbRegister.Reload();
            if (!dbRegister.IsLoaded)
            {
                dbRegister.Load();
            }

            // Linq по коллекции
            var registerGroups = from registerRow in dbRegister
                                 group registerRow by
                                 new {
                registerRow.PrimaryParty,
                registerRow.ContragentParty,
                registerRow.Contract,
                registerRow.ContractDeal,
                registerRow.ObligationUnit,
                registerRow.Stage
            }
            into registerGroup
                select new {
                RegGroup = registerGroup,

                PrimaryPartyOid     = registerGroup.Key.PrimaryParty.Oid,
                PrimaryPartyName    = registerGroup.Key.PrimaryParty.Person.NameFull,
                ContragentPartyOid  = registerGroup.Key.ContragentParty.Oid,
                ContragentPartyName = registerGroup.Key.ContragentParty.Person.NameFull,
                ContractOid         = registerGroup.Key.Contract.Oid,
                //!!!Паша нужно подставит ьправильное значение
                //ContractName = registerGroup.Key.Contract.Delo,
                ContractName     = " ",
                ContractDealOid  = registerGroup.Key.ContractDeal.Oid,
                ContractDealName = registerGroup.Key.ContractDeal.Name,
                StageOid         = registerGroup.Key.Stage.Oid,
                StageName        = registerGroup.Key.Stage.Code,

                ValutaName = registerGroup.Key.ObligationUnit.Valuta.Code,

                ObligationUnitOid      = registerGroup.Key.ObligationUnit.Oid,
                ObligationUnitDateTime = registerGroup.Key.ObligationUnit.DatePlane,                          // Уточнить!
                ObligationUnitCode     = registerGroup.Key.ObligationUnit.Code,


                DeliveryCostPlan =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     & regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.PLAN
                     & (regRow.ObligationUnit as crmDeliveryUnit) != null
                     select regRow.CreditCostInRUR).Sum()
                ,
                PaymentCostPlan =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     & regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.PLAN
                     & (regRow.ObligationUnit as crmPaymentUnit) != null
                     select regRow.CreditCostInRUR).Sum()
                ,
                DeliveryCostFact =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     & regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.FACT
                     & (regRow.ObligationUnit as crmDeliveryUnit) != null
                     select regRow.DebitCostInRUR).Sum()
                ,
                PaymentCostFact =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     & regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.FACT
                     & (regRow.ObligationUnit as crmPaymentUnit) != null
                     select regRow.DebitCostInRUR).Sum()
                ,



                DeliveryCostCumulativePlan =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     //& regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.PLAN
                     & (regRow.ObligationUnit as crmDeliveryUnit) != null
                     & regRow.ObligationUnitDateTime <= registerGroup.Key.ObligationUnit.DatePlane
                     select regRow.CreditCostInRUR).Sum()
                ,
                PaymentCostCumulativePlan =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     //& regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.PLAN
                     & (regRow.ObligationUnit as crmPaymentUnit) != null
                     & regRow.ObligationUnitDateTime <= registerGroup.Key.ObligationUnit.DatePlane
                     select regRow.CreditCostInRUR).Sum()
                ,
                DeliveryCostCumulativeFact =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     //& regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.FACT
                     & (regRow.ObligationUnit as crmDeliveryUnit) != null
                     & regRow.ObligationUnitDateTime <= registerGroup.Key.ObligationUnit.DatePlane
                     select regRow.DebitCostInRUR).Sum()
                ,
                PaymentCostCumulativeFact =
                    (from regRow in dbRegister
                     where
                     regRow.PrimaryParty == registerGroup.Key.PrimaryParty
                     & regRow.ContragentParty == registerGroup.Key.ContragentParty
                     & regRow.Contract == registerGroup.Key.Contract
                     & regRow.ContractDeal == registerGroup.Key.ContractDeal
                     //& regRow.Stage == registerGroup.Key.Stage
                     & regRow.ObligationUnit == registerGroup.Key.ObligationUnit
                     & regRow.PlaneFact == PlaneFact.FACT
                     & (regRow.ObligationUnit as crmPaymentUnit) != null
                     & regRow.ObligationUnitDateTime <= registerGroup.Key.ObligationUnit.DatePlane
                     select regRow.DebitCostInRUR).Sum()
            };

            //XPCollection xpColSpravka0103 = new XPCollection(ssn, typeof(Spravka0103));
            List <BaseReportHelper> xpColSpravka0103 = new List <BaseReportHelper>();


            // Для каждой группы формируем запись
            foreach (var grp in registerGroups)
            {
                foreach (var item in grp.RegGroup)
                {
                    Spravka0103 sprObj = new Spravka0103(ssn);

                    //sprObj.Oid = item.Oid;

                    sprObj.PrimaryPartyOid    = grp.PrimaryPartyOid;
                    sprObj.ContragentPartyOid = grp.ContragentPartyOid;
                    sprObj.ContractOid        = grp.ContractOid;
                    sprObj.ContractDealOid    = grp.ContractDealOid;
                    sprObj.ObligationUnitOid  = grp.ObligationUnitOid;
                    sprObj.StageOid           = grp.StageOid;

                    sprObj.ObligationUnitDateTime = grp.ObligationUnitDateTime;
                    sprObj.ObligationUnitCode     = grp.ObligationUnitCode;

                    sprObj.PrimaryPartyName    = grp.PrimaryPartyName;    //item.PrimaryParty.PartyName;
                    sprObj.ContragentPartyName = grp.ContragentPartyName; //item.ContragentParty.PartyName;
                    sprObj.ContractName        = grp.ContractName;
                    sprObj.ContractDealName    = grp.ContractDealName;    // item.ContractDeal.ContractDocument.FullName;
                    sprObj.StageName           = grp.StageName;

                    sprObj.ValutaName = grp.ValutaName;

                    // Вычислить 4-е величины
                    sprObj.DeliveryCostPlan = grp.DeliveryCostPlan;
                    sprObj.PaymentCostPlan  = grp.PaymentCostPlan;
                    sprObj.DeliveryCostFact = grp.DeliveryCostFact;
                    sprObj.PaymentCostFact  = grp.PaymentCostFact;

                    // Вычислить 4-е накопительные величины
                    sprObj.DeliveryCostCumulativePlan = grp.DeliveryCostCumulativePlan;
                    sprObj.PaymentCostCumulativePlan  = grp.PaymentCostCumulativePlan;
                    sprObj.DeliveryCostCumulativeFact = grp.DeliveryCostCumulativeFact;
                    sprObj.PaymentCostCumulativeFact  = grp.PaymentCostCumulativeFact;


                    //sprObj.DeliveryCostPlanFact = Convert.ToDecimal(sprObj.DeliveryCostPlan) - Convert.ToDecimal(sprObj.DeliveryCostFact);
                    //sprObj.PaymentCostPlanFact = Convert.ToDecimal(sprObj.PaymentCostPlan) - Convert.ToDecimal(sprObj.PaymentCostFact);
                    //sprObj.ResultPlanFact = Convert.ToDecimal(sprObj.DeliveryCostPlanFact) - Convert.ToDecimal(sprObj.PaymentCostPlanFact);

                    //obj["PrimaryPartyOid"] = grp.PrimaryPartyOid;
                    //obj["ContragentPartyOid"] = grp.ContragentPartyOid;
                    //obj["ContractOid"] = grp.ContractOid;
                    //obj["ContractDealOid"] = grp.ContractDealOid;
                    //obj["ObligationUnitOid"] = grp.ObligationUnitOid;
                    //obj["StageOid"] = grp.StageOid;

                    //obj["ObligationUnitDateTime"] = grp.ObligationUnitDateTime;
                    //obj["ObligationUnitCode"] = grp.ObligationUnitCode;

                    //obj["PrimaryPartyName"] = grp.PrimaryPartyName;    //item.PrimaryParty.PartyName;
                    //obj["ContragentPartyName"] = grp.ContragentPartyName;    //item.ContragentParty.PartyName;
                    //obj["ContractName"] = grp.ContractName;
                    //obj["ContractDealName"] = grp.ContractDealName;   // item.ContractDeal.ContractDocument.FullName;
                    //obj["StageName"] = grp.StageName;

                    //obj["ValutaName"] = grp.ValutaName;

                    //// Вычислить 4-е величины
                    //obj["DeliveryCostPlan"] = grp.DeliveryCostPlan;
                    //obj["PaymentCostPlan"] = grp.PaymentCostPlan;
                    //obj["DeliveryCostFact"] = grp.DeliveryCostFact;
                    //obj["PaymentCostFact"] = grp.PaymentCostFact;

                    //// Вычислить 4-е накопительные величины
                    //obj["DeliveryCostCumulativePlan"] = grp.DeliveryCostCumulativePlan;
                    //obj["PaymentCostCumulativePlan"] = grp.PaymentCostCumulativePlan;
                    //obj["DeliveryCostCumulativeFact"] = grp.DeliveryCostCumulativeFact;
                    //obj["PaymentCostCumulativeFact"] = grp.PaymentCostCumulativeFact;

                    xpColSpravka0103.Add(sprObj);
                }
            }

            return(xpColSpravka0103);
        }
Ejemplo n.º 41
0
        private void simpleButtonReport_Click(object sender, EventArgs e)
        {
            _Ingresso = this.lookUpEdit1.EditValue as Ingresso;
            _List     = new List <DatiReport01>();
            _Aperture = new GestoreAperture();

            if (_Ingresso == null)
            {
                return;
            }

            if (this.dateEditFine.DateTime.Date >= DateTime.Now.Date)
            {
                XtraMessageBox.Show("Data Fine non può essere maggiore della data odierna", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Cursor saveCursor = Cursor.Current;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                _Aperture.CaricaApertureIngressi(this.dateEditInizio.DateTime, this.dateEditFine.DateTime.AddMonths(1), this.unitOfWork1);

                XPCollection <Vendita> vendite = new XPCollection <Vendita>(this.unitOfWork1);
                vendite.Criteria = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataContabile", this.dateEditInizio.DateTime, BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataContabile", this.dateEditFine.DateTime, BinaryOperatorType.LessOrEqual)
                });

                foreach (Vendita item in vendite)
                {
                    foreach (RigaVenditaVariante rigaVenditaVariante in item.RigheVenditaVariante)
                    {
                        foreach (Ingresso ingresso in rigaVenditaVariante.Variante.Biglietto.Percorso.Ingressi)
                        {
                            if (ingresso.Oid == _Ingresso.Oid)
                            {
                                AddToList(rigaVenditaVariante, ingresso);
                            }
                        }
                    }
                }

                XPCollection <Entrata> entrate = new XPCollection <Entrata>(this.unitOfWork1);
                entrate.Criteria = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[]
                {
                    new BinaryOperator("DataOraEntrata", this.dateEditInizio.DateTime, BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("DataOraEntrata", this.dateEditFine.DateTime.AddDays(1), BinaryOperatorType.Less),
                    new BinaryOperator("RigaStampaIngresso.Ingresso.Oid", _Ingresso.Oid),
                    new NotOperator(new NullOperator("RigaStampaIngresso.Stampa.Card"))
                });

                foreach (var entrata in entrate)
                {
                    AddCardToList(entrata, _Ingresso);
                }


                XtraReport01 report = new XtraReport01();

                report.Init(_List, this.dateEditInizio.DateTime, this.dateEditFine.DateTime, this.memoEditInfo.Text);

                report.ShowRibbonPreviewDialog();
            }
            finally
            {
                Cursor.Current = saveCursor;
            }
        }
Ejemplo n.º 42
0
        public List <string> header_debit_correspond()
        {
            List <string> debit_correspond = new List <string>();

            #region tham số
            int    month    = Int32.Parse(this.hS04b10DN_month.Get("month_id").ToString());
            int    year     = Int32.Parse(this.hS04b10DN_year.Get("year_id").ToString());
            string owner    = "QUASAPHARCO";
            string fAccount = "157";
            #endregion

            #region object
            MonthDim    md  = session.FindObject <MonthDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", month)));
            YearDim     yd  = session.FindObject <YearDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", year)));
            OwnerOrgDim ood = session.FindObject <OwnerOrgDim>(CriteriaOperator.Parse(String.Format("Code='{0}'",
                                                                                                    owner)));
            int CorrespondFinancialAccountDimId_default = CorrespondFinancialAccountDim.GetDefault(session,
                                                                                                   CorrespondFinancialAccountDimEnum.NAAN_DEFAULT).CorrespondFinancialAccountDimId;
            string rowStatusActive = Utility.Constant.ROWSTATUS_ACTIVE.ToString();
            #endregion

            XPCollection <FinancialAccountDim> f_c_FinancialAccountDim = new XPCollection <FinancialAccountDim>(session,
                                                                                                                CriteriaOperator.Parse(String.Format("Code like '{0}%' AND RowStatus='{1}'", fAccount, rowStatusActive)));

            if (f_c_FinancialAccountDim.Count != 0)
            {
                foreach (FinancialAccountDim each_tk in f_c_FinancialAccountDim)
                {
                    if (md != null && yd != null && ood != null)
                    {
                        GoodsInTransitForSaleSummary_Fact GoodsSummary_Fact =
                            session.FindObject <GoodsInTransitForSaleSummary_Fact>
                                (CriteriaOperator.Parse(String.Format("MonthDimId='{0}' AND "
                                                                      + "YearDimId='{1}' AND "
                                                                      + "OwnerOrgDimId='{2}' AND "
                                                                      + "FinancialAccountDimId='{3}' AND "
                                                                      + "RowStatus='{4}'",
                                                                      md.MonthDimId,
                                                                      yd.YearDimId,
                                                                      ood.OwnerOrgDimId,
                                                                      each_tk.FinancialAccountDimId,
                                                                      rowStatusActive
                                                                      )));
                        if (GoodsSummary_Fact != null)
                        {
                            XPCollection <GoodsInTransitForSaleDetail> collec_detail =
                                new XPCollection <GoodsInTransitForSaleDetail>(session, CriteriaOperator.Parse(
                                                                                   String.Format("GoodsInTransitForSaleSummary_FactId='{0}' AND "
                                                                                                 + "Debit>0 AND "
                                                                                                 + "CorrespondFinancialAccountDimId!='{1}' AND "
                                                                                                 + "RowStatus='{2}'",
                                                                                                 GoodsSummary_Fact.GoodsInTransitForSaleSummary_FactId,
                                                                                                 CorrespondFinancialAccountDimId_default,
                                                                                                 rowStatusActive
                                                                                                 )));
                            if (collec_detail.Count != 0)
                            {
                                foreach (GoodsInTransitForSaleDetail each_detail in collec_detail)
                                {
                                    if (!debit_correspond.Contains(each_detail.CorrespondFinancialAccountDimId.Code))
                                    {
                                        debit_correspond.Add(each_detail.CorrespondFinancialAccountDimId.Code);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            debit_correspond.Sort();
            return(debit_correspond);
        }
Ejemplo n.º 43
0
        public static XPCollection <Allergen> GetAllergens(ref Session session)
        {
            XPCollection <Allergen> AllergeXPCollection = new XPCollection <Allergen>(session);

            return(AllergeXPCollection);
        }
Ejemplo n.º 44
0
        private void simpleButtonCalcola_Click(object sender, EventArgs e)
        {
            _Inizio = this.dateEditInizioPeriodo.DateTime.Date;
            _Fine   = this.dateEditFinePeriodo.DateTime.Date;

            //this.dateEditInizioPeriodo.Enabled = false;
            this.dateEditInizioPeriodo.Properties.ReadOnly = true;

            //this.dateEditFinePeriodo.Enabled = false;
            this.dateEditFinePeriodo.Properties.ReadOnly = true;

            this.simpleButtonCalcola.Visible = false;

            this.groupControl1.Visible = true;
            this.groupControl1.Text    = string.Format("Importi registrati dal {0:d} al {1:d}", _Inizio, _Fine);

            _PosTot   = new Dictionary <DateTime, decimal>();
            _PosAltri = new Dictionary <DateTime, decimal>();

            XPCollection <Vendita> vendite = new XPCollection <Vendita>(this.unitOfWork1);

            vendite.Criteria = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] {
                new BinaryOperator("Struttura.Oid", _Struttura.Oid),
                new BinaryOperator("DataContabile", _Inizio, BinaryOperatorType.GreaterOrEqual),
                new BinaryOperator("DataContabile", _Fine, BinaryOperatorType.LessOrEqual)
            });

            decimal posquesta = 0;
            decimal posaltre  = 0;

            decimal conquesta = 0;
            decimal conaltre  = 0;

            foreach (Vendita vendita in vendite)
            {
                switch (vendita.Incasso)
                {
                case EnumIncasso.Pos:
                    foreach (RigaVenditaVariante rigaVenditaVariante in vendita.RigheVenditaVariante)
                    {
                        if (rigaVenditaVariante.Variante.Biglietto.Gestore == _Struttura.SoggettoEconomico)
                        {
                            posquesta += rigaVenditaVariante.PrezzoTotale;
                        }
                        else
                        {
                            posaltre += rigaVenditaVariante.PrezzoTotale;

                            if (_PosAltri.ContainsKey(vendita.DataContabile))
                            {
                                _PosAltri[vendita.DataContabile] += rigaVenditaVariante.PrezzoTotale;
                            }
                            else
                            {
                                _PosAltri[vendita.DataContabile] = rigaVenditaVariante.PrezzoTotale;
                            }
                        }

                        if (_PosTot.ContainsKey(vendita.DataContabile))
                        {
                            _PosTot[vendita.DataContabile] += rigaVenditaVariante.PrezzoTotale;
                        }
                        else
                        {
                            _PosTot[vendita.DataContabile] = rigaVenditaVariante.PrezzoTotale;
                        }
                    }
                    break;

                case EnumIncasso.Contanti:
                    foreach (RigaVenditaVariante rigaVenditaVariante in vendita.RigheVenditaVariante)
                    {
                        if (rigaVenditaVariante.Variante.Biglietto.Gestore == _Struttura.SoggettoEconomico)
                        {
                            conquesta += rigaVenditaVariante.PrezzoTotale;
                        }
                        else
                        {
                            conaltre += rigaVenditaVariante.PrezzoTotale;
                        }
                    }
                    break;

                default:
                    throw new Exception(String.Format("Caso non previsto: {0}", vendita.Incasso));
                }
            }

            this.textEditPosQuesto.Value = posquesta;
            this.textEditPosAltri.Value  = posaltre;
            this.textEditPosTotale.Value = posquesta + posaltre;

            this.textEditConQuesto.Value = conquesta;
            this.textEditConAltri.Value  = conaltre;
            this.textEditConTotale.Value = conquesta + conaltre;

            this.simpleButtonRegistra.Enabled = true;
        }
Ejemplo n.º 45
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");

                //保存销售记录
                foreach (SA01 sa01 in xpCollection_sa01)
                {
                    sa01.SA008 = '1';                   //结算状态
                    sa01.SA010 = s_fa001;               //结算流水号
                    sa01.SA020 = 'T';                   //发票类型
                    sa01.SA100 = Envior.cur_userId;     //经办人
                    sa01.SA200 = Tools.GetServerDate(); //经办日期
                    dec_sum   += sa01.SA007;
                }
                //财务收费信息
                FA01 fa01 = new FA01(unitOfWork1);
                fa01.FA001  = s_fa001;                              //缴费流水号
                fa01.FA002  = '1';                                  //收费类型 0-购墓 1-服务祭品 2-管理费
                fa01.FA003  = te_cuname.Text;                       //缴费人
                fa01.FA004  = dec_sum;                              //收费金额
                fa01.FA190  = '0';                                  //开票标志 0-未开票
                fa01.FA100  = Envior.cur_userId;                    //收费人
                fa01.FA180  = "";                                   //备注
                fa01.FA200  = Tools.GetServerDate();                //缴费时间
                fa01.STATUS = "1";                                  //状态
                fa01.WS001  = Envior.WORKSTATIONID;                 //工作站标识
                fa01.Save();

                unitOfWork1.CommitTransaction();

                //////////保存完成 //////////
                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("办理成功!\r\n" + "本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sb_ok.Enabled = false;
                    //获取税务客户信息
                    string            s_ac003       = te_cuname.Text;
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fp01.FP001, clientInfo);
                            }
                        }
                    }
                }

                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Ejemplo n.º 46
0
        private void PopulateMUMDefaultConfig()
        {
            using (Session session = XpoHelper.GetNewSession())
            {
                //Get item list
                XPCollection <Item> itemList = new XPCollection <Item>(session,
                                                                       new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE));

                //Get specification unit type
                NAS.DAL.Nomenclature.UnitItem.UnitType specUnitType =
                    session.FindObject <NAS.DAL.Nomenclature.UnitItem.UnitType>(new BinaryOperator("Code", "SPECIFICATION"));

                foreach (var item in itemList)
                {
                    int countHasConfigSpecUnit = item.itemUnitTypeConfigs.Count(r =>
                                                                                r.RowStatus == Utility.Constant.ROWSTATUS_ACTIVE &&
                                                                                r.UnitTypeId == specUnitType);

                    if (countHasConfigSpecUnit != 0)
                    {
                        continue;
                    }

                    //Config SPECIFICATION for the item
                    int countSpecConfigUnit = item.itemUnitTypeConfigs.Count(r =>
                                                                             r.UnitTypeId == specUnitType);

                    ItemUnitTypeConfig config;

                    if (countSpecConfigUnit != 0)
                    {
                        config = item.itemUnitTypeConfigs.Where(r =>
                                                                r.UnitTypeId == specUnitType).FirstOrDefault();
                        config.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE;
                    }
                    else
                    {
                        config = new ItemUnitTypeConfig(session)
                        {
                            ItemId     = item,
                            RowStatus  = Utility.Constant.ROWSTATUS_ACTIVE,
                            UnitTypeId = specUnitType
                        };
                    }

                    //Config isMaster flag
                    int countIsMaster = item.itemUnitTypeConfigs.Count(r => r.IsMaster);

                    if (countIsMaster == 0)
                    {
                        config.IsMaster = true;
                    }

                    config.Save();

                    //Active SPECIFICATION units of the item
                    var specItemUnitList = item.ItemUnits.Where(r => r.UnitId != null &&
                                                                r.UnitId.UnitTypeId == specUnitType &&
                                                                r.UnitId.RowStatus == Utility.Constant.ROWSTATUS_ACTIVE);
                    foreach (var specItemUnit in specItemUnitList)
                    {
                        specItemUnit.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE;
                        specItemUnit.Save();
                    }
                }
            }
        }
Ejemplo n.º 47
0
        private void TinhLuongTheoCongThuc()
        {
            for (int i = 0; i < xpcChiTietLuong.Count; i++)
            {
                ChiTietTienLuong ctLuong = xpcChiTietLuong[i] as ChiTietTienLuong;

                #region TÍNH LƯƠNG THEO CÔNG THỨC
                using (var uow = new UnitOfWork())
                {
                    LoaiDuLieuTinhLuong temp = uow.FindObject <LoaiDuLieuTinhLuong>(CriteriaOperator.Parse("Oid = ?", ctLuong.LoaiDLTinhLuong.Oid));
                    //Kiểm tra xem loại dữ liệu tính lương này có sử dụng công thức không
                    if (!String.IsNullOrEmpty(temp.CongThuc))
                    {
                        //Công thức được định dạng chuẩn:

                        /* Cột lưu [C+số thứ tự] : C tiền tớ bắt buộc
                         * Giá trị [Giá Trị]
                         * VD: [C3] + [C5] * [100]*/


                        string[] congThuc = temp.CongThuc.Split('[', ']'); // "", C3, +, C10, *, 100, "" 8+10*100
                        string   bieuthuc = string.Empty;
                        for (int j = 1; j < congThuc.Length; j++)
                        {
                            if (congThuc[j].Contains('C'))
                            {
                                XPCollection xpcGiatri = new XPCollection(xpcChiTietLuong, CriteriaOperator.And(
                                                                              new BinaryOperator("Thang", ctLuong.Thang), new BinaryOperator("NhanVien", ctLuong.NhanVien)
                                                                              , new BinaryOperator("LoaiDLTinhLuong.STT", congThuc[j].Substring(1))));
                                if (xpcGiatri.Count > 0)
                                {
                                    ChiTietTienLuong cttl = xpcGiatri[0] as ChiTietTienLuong;
                                    if (cttl.LoaiDLTinhLuong.CongThuc.Contains('['))
                                    {
                                    }
                                    decimal temp1 = (xpcGiatri[0] as ChiTietTienLuong).GiaTri;
                                    bieuthuc += temp1;
                                }
                            }
                            else
                            {
                                if (congThuc[j] != "")
                                {
                                    bieuthuc += congThuc[j];
                                }
                            }
                        }
                        ctLuong.GiaTri = TinhBieuThucDonGian(bieuthuc);
                    }
                }
                #endregion

                #region TÍNH LƯƠNG THEO CHỨC VỤ
                if (ctLuong.LoaiDLTinhLuong.NhomChucVu)
                {
                    XPCollection xpcGiaTriTheoChucVu = new XPCollection(xpcGiaTriTienLuongTheoChucVu, CriteriaOperator.And(new BinaryOperator("ChucVu", ctLuong.NhanVien.ChucVu),
                                                                                                                           new BinaryOperator("MucTienLuong", ctLuong.LoaiDLTinhLuong)));
                    if (xpcGiaTriTheoChucVu.Count > 0)
                    {
                        GiaTriTienLuongTheoChucVu gtLuongTheoChucVu = xpcGiaTriTheoChucVu[0] as GiaTriTienLuongTheoChucVu;
                        ctLuong.GiaTri = gtLuongTheoChucVu.GiaTri == null ? 0 : gtLuongTheoChucVu.GiaTri;
                    }
                }
                #endregion
            }
            XpoDefault.Session.Save(xpcChiTietLuong);
            pivotGridControl1.RefreshData();
        }
Ejemplo n.º 48
0
        private void DefaultRegister_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ObjectSpace objectSpace = Application.CreateObjectSpace();

            dicStudentRegDetail = new Dictionary <string, List <string> >();
            Student currentStudent;
            Lesson  curLesson;
            Dictionary <string, List <string> > errorstudent           = new Dictionary <string, List <string> >();
            Dictionary <string, int>            dicLessonCurrentRegNum = new Dictionary <string, int>();
            int     numregok = 0;
            Vacancy vc;
            bool    isConflictTKB = false;

            using (XPCollection <Lesson> newCollectionSource = new XPCollection <Lesson>(objectSpace.Session))
            {
                objectSpace.Session.BeginTransaction();
                foreach (StudentClass studentClass in View.SelectedObjects)
                {
                    newCollectionSource.Criteria = CriteriaOperator.Parse(
                        "ClassIDs like ?", string.Format("%{0}%", studentClass.ClassCode));

                    foreach (Student student in studentClass.Students)
                    {
                        listVacancies  = new List <Vacancy>();
                        currentStudent = objectSpace.FindObject <Student>(
                            new BinaryOperator("StudentCode", student.StudentCode));

                        foreach (Lesson lesson in newCollectionSource)
                        {
                            isConflictTKB = false;
                            if (!dicLessonCurrentRegNum.ContainsKey(lesson.LessonName))
                            {
                                dicLessonCurrentRegNum[lesson.LessonName] = 0;
                            }
                            foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                            {
                                vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                                if (Utils.IsConfictTKB(listVacancies, vc))
                                {
                                    isConflictTKB = true;
                                    break;
                                }
                            }

                            if (isConflictTKB)
                            {
                                if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                {
                                    errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                }
                                if (!errorstudent[currentStudent.StudentCode].Contains(lesson.Subject.SubjectCode))
                                {
                                    errorstudent[currentStudent.StudentCode].Add(lesson.Subject.SubjectCode + "{T}");
                                }
                            }
                            else
                            {
                                //si so chon chua vuot qua
                                if (lesson.NumExpectation > dicLessonCurrentRegNum[lesson.LessonName] + lesson.NumRegistration)
                                {
                                    curLesson = objectSpace.FindObject <Lesson>(
                                        new BinaryOperator("Oid", lesson.Oid));
                                    RegisterDetail regdetail = new RegisterDetail(objectSpace.Session)
                                    {
                                        Student       = currentStudent,
                                        Lesson        = curLesson,
                                        RegisterState = objectSpace.FindObject <RegisterState>(
                                            new BinaryOperator("Code", "SELECTED")),
                                        CheckState = objectSpace.FindObject <RegisterState>(
                                            new BinaryOperator("Code", "NOTCHECKED"))
                                    };
                                    RuleSet ruleSet = new RuleSet();

                                    RuleSetValidationResult result = ruleSet.ValidateTarget(regdetail, DefaultContexts.Save);
                                    if (ValidationState.Invalid ==
                                        result.GetResultItem("RegisterDetail.StudentRegLessonSemester").State)
                                    {
                                        if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                        {
                                            errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                        }
                                        if (!errorstudent[currentStudent.StudentCode].Contains(curLesson.Subject.SubjectCode))
                                        {
                                            errorstudent[currentStudent.StudentCode].Add(curLesson.Subject.SubjectCode + "{D}");
                                        }
                                        regdetail.Delete();
                                        //regdetail.Reload();
                                    }
                                    else
                                    {
                                        numregok++;
                                        if (!dicStudentRegDetail.ContainsKey(student.StudentCode))
                                        {
                                            dicStudentRegDetail.Add(student.StudentCode, new List <string>());
                                        }
                                        dicStudentRegDetail[student.StudentCode].Add(curLesson.LessonName);

                                        dicLessonCurrentRegNum[lesson.LessonName]++;
                                        foreach (TkbSemester tkbsem in curLesson.TKBSemesters)
                                        {
                                            vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                                            listVacancies.Add(vc);
                                        }
                                        regdetail.Save();
                                    }
                                }
                                else
                                {
                                    if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                    {
                                        errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                    }
                                    if (!errorstudent[currentStudent.StudentCode].Contains(lesson.Subject.SubjectCode))
                                    {
                                        errorstudent[currentStudent.StudentCode].Add(lesson.Subject.SubjectCode + "{H}");
                                    }
                                }
                            }
                        }
                    }
                }
                objectSpace.Session.CommitTransaction();
                PopUpMessage ms = objectSpace.CreateObject <PopUpMessage>();
                if (errorstudent.Count > 0)
                {
                    ms.Title   = "Có lỗi khi chọn nhóm MH đăng ký!";
                    ms.Message = string.Format("Đã chọn được cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                    string strmessage = "Không chọn được nhóm môn học do trùng môn đã đăng ký, trùng lịch hoặc hết chỗ: ";
                    foreach (KeyValuePair <string, List <string> > keypair in errorstudent)
                    {
                        strmessage += string.Format("Sinh viên:[{0}] - Môn:[", keypair.Key);
                        foreach (string str in keypair.Value)
                        {
                            strmessage += str + ",";
                        }
                        strmessage  = strmessage.TrimEnd(',');
                        strmessage += "]\r\n";
                    }
                    ms.Message += strmessage;
                }
                else
                {
                    ms.Title   = "Chọn nhóm MH thành công";
                    ms.Message = string.Format("Chọn nhóm MH thành công cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                }
                ShowViewParameters svp = new ShowViewParameters();
                svp.CreatedView = Application.CreateDetailView(
                    objectSpace, ms);
                svp.TargetWindow        = TargetWindow.NewModalWindow;
                svp.CreatedView.Caption = "Thông báo";
                DialogController dc = Application.CreateController <DialogController>();
                svp.Controllers.Add(dc);

                dc.SaveOnAccept = false;
                Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
            }
        }
Ejemplo n.º 49
0
        public List <TFCodeTaskTriggerTaskChain> GetListCodeTaskTriggerTaskChains()
        {
            var xpcCodeTaskTriggerTaskChains = new XPCollection <TFCodeTaskTriggerTaskChain>(TheUow, CriteriaOperator.Parse("g_CodeTaskGuid = ?", g_ID));

            return(xpcCodeTaskTriggerTaskChains.ToList());
        }
Ejemplo n.º 50
0
        public static IList <WeeklyInventory> GetThisWeeksInventroy(DateTime StartDate, DateTime EndDate, IObjectSpace space)
        {
            IList <WeeklyInventory> weeklyInventory = new List <WeeklyInventory>();

            // IObjectSpace space = AppHelper.Application.CreateObjectSpace();
            //get the list of locations
            IList <Location> locationList = space.GetObjects <Location>();
            bool             groupCheck   = false;

            foreach (Location loc in locationList)
            {
                //filter the measures by LDC and date
                if (loc.Name.Contains("IPS"))
                {
                    Console.Write('s');
                }
                WeeklyInventory WeekI = new WeeklyInventory();
                WeekI.Location = loc;

                XPCollection <Move> moves = loc.MoveFrom;

                // BetweenOperator betOp = new BetweenOperator("MoveDate", DateTime.Now.AddDays(-97), DateTime.Now.AddDays(-90));

                BetweenOperator betOp = new BetweenOperator("MoveDate", StartDate, EndDate);
                NotOperator     notOP = new NotOperator(new NullOperator("Appliance"));

                GroupOperator grpOP = new GroupOperator();
                grpOP.OperatorType = GroupOperatorType.And;
                grpOP.Operands.Add(betOp);
                grpOP.Operands.Add(notOP);

                moves.Filter = grpOP;
                //       moves.Filter = betOp;



                List <InventoryItem> invList = new List <InventoryItem>();

                //loc.MoveFrom[0].Appliance



                foreach (Move mov in moves)
                {
                    FastFileLineItem item = space.FindObject <FastFileLineItem>(new BinaryOperator("Move.Oid", mov.Oid.ToString()));

                    foreach (InventoryItem inv in invList)
                    {
                        if (item.HAPApplication != null && mov.Appliance.SageName == inv.Appliance.SageName && mov.LocationTo.Name == inv.LocationTo.Name &&
                            item.HAPApplication.BasicScheduledDate.ToString("dd/MM/yyyy") == inv.InstallDate.ToString("dd/MM/yyyy"))
                        {
                            inv.Quantity += mov.Quantity;
                            groupCheck    = true;
                        }
                        else if (item.ENBLIApplication != null && mov.Appliance.SageName == inv.Appliance.SageName && mov.LocationTo.Name == inv.LocationTo.Name &&
                                 item.ENBLIApplication.TAPSAssessmentDate.ToString("dd/MM/yyyy") == inv.InstallDate.ToString("dd/MM/yyyy"))
                        {
                            inv.Quantity += mov.Quantity;
                            groupCheck    = true;
                        }
                        else if (item.ENBLIApplication != null && mov.Appliance.SageName == inv.Appliance.SageName && mov.LocationTo.Name == inv.LocationTo.Name &&
                                 item.ENBLIApplication.ENBLIADate.ToString("dd/MM/yyyy") == inv.InstallDate.ToString("dd/MM/yyyy"))
                        {
                            inv.Quantity += mov.Quantity;
                            groupCheck    = true;
                        }
                    }

                    if (!groupCheck)
                    {
                        if (item.HAPApplication != null)
                        {
                            InventoryItem invItem = new InventoryItem();
                            invItem.Appliance   = mov.Appliance;
                            invItem.LocationTo  = mov.LocationTo;
                            invItem.Quantity    = mov.Quantity;
                            invItem.InstallDate = item.HAPApplication.BasicScheduledDate;
                            invList.Add(invItem);
                        }
                        else if (item.ENBLIApplication != null)
                        {
                            InventoryItem invItem = new InventoryItem();
                            invItem.Appliance  = mov.Appliance;
                            invItem.LocationTo = mov.LocationTo;
                            invItem.Quantity   = mov.Quantity;

                            if (item.ENBLIApplication.TAPSAssessmentDate != null && item.ENBLIApplication.TAPSAssessmentDate != DateTime.MinValue)
                            {
                                invItem.InstallDate = item.ENBLIApplication.TAPSAssessmentDate;
                            }
                            else
                            {
                                invItem.InstallDate = item.ENBLIApplication.ENBLIADate;
                            }


                            invList.Add(invItem);
                        }
                    }

                    groupCheck = false;
                }

                if (invList.Count > 0)
                {
                    WeekI.InventoryItemList = invList;
                    weeklyInventory.Add(WeekI);
                }
            }

            return(weeklyInventory);
        }
Ejemplo n.º 51
0
        public List <TFCodeWorkItemInCodeTask> GetListCodeWorkItemInCodeTasks()
        {
            var xpcCodeWorkItemInCodeTask = new XPCollection <TFCodeWorkItemInCodeTask>(TheUow, CriteriaOperator.Parse("g_CodeTaskGuid = ?", g_ID));

            return(xpcCodeWorkItemInCodeTask.ToList());
        }
Ejemplo n.º 52
0
        public List <TFCodeDeadline> GetListCodeDeadlines()
        {
            var xpcCodeBaseDateInCodeDeadlines = new XPCollection <TFCodeBaseDateInCodeDeadline>(TheUow, CriteriaOperator.Parse("n_CodeBaseDateID = ?", n_ID));

            return(xpcCodeBaseDateInCodeDeadlines.Where(w => w != null).Select(s => s.GetTheCodeDeadline()).Distinct().ToList());
        }
Ejemplo n.º 53
0
        static void Main(string[] args)
        {
            XPDictionary dict = new ReflectionDictionary();

            Type[] types = new Type[] { typeof(Supplier), typeof(Product), typeof(Group) };
            dict.CollectClassInfos(types);

            XPClassInfo ciSupplier = dict.GetClassInfo(typeof(Supplier));
            XPClassInfo ciProduct  = dict.GetClassInfo(typeof(Product));
            XPClassInfo ciGroup    = dict.GetClassInfo(typeof(Group));
            //A one-to-many association
            XPMemberInfo miSupplier = ciProduct.CreateMember("Supplier", typeof(Supplier), new AssociationAttribute("SupplierProducts"));
            XPMemberInfo miProducts = ciSupplier.CreateMember("Products", typeof(XPCollection), true, new AssociationAttribute("SupplierProducts", typeof(Product)));
            //A many-to-many association
            XPMemberInfo miGroups = ciProduct.CreateMember("Groups", typeof(XPCollection), true, new AssociationAttribute("GroupsItems", typeof(Group)));
            XPMemberInfo miItems  = ciGroup.CreateMember("Items", typeof(XPCollection), true, new AssociationAttribute("GroupsItems", typeof(Product)));

            //Creating a data layer
            IDataStore provider = new InMemoryDataStore();

            //IDataStore provider = XpoDefault.GetConnectionProvider(MSSqlConnectionProvider.GetConnectionString("localhost", ""), AutoCreateOption.DatabaseAndSchema);
            XpoDefault.DataLayer = new SimpleDataLayer(dict, provider);
            XpoDefault.Session   = null;

            //Creating sample data
            using (UnitOfWork session = new UnitOfWork()) {
                session.ClearDatabase();
                session.UpdateSchema(types);
                session.CreateObjectTypeRecords(types);

                Supplier s1 = new Supplier(session)
                {
                    CompanyName = "Acme", Address = "XY/101"
                };
                Supplier s2 = new Supplier(session)
                {
                    CompanyName = "Zorq", Address = "Moonbase"
                };
                Product p1 = new Product(session)
                {
                    Name = "Anvil", Quantity = 1
                };
                miSupplier.SetValue(p1, s1);
                Product p2 = new Product(session)
                {
                    Name = "Cow", Quantity = 80
                };
                ((XPCollection)miProducts.GetValue(s1)).Add(p2);
                Product p3 = new Product(session)
                {
                    Name = "Saucer", Quantity = 3
                };
                ciProduct.GetMember("Supplier").SetValue(p3, s2);
                Group g1 = new Group(session)
                {
                    Title = "Flying"
                };
                ((XPCollection)miItems.GetValue(g1)).Add(p2);
                ((XPCollection)miGroups.GetValue(p3)).Add(g1);
                session.CommitChanges();
            }

            //Some tests
            using (UnitOfWork session = new UnitOfWork()) {
                Group        g1         = session.FindObject <Group>(CriteriaOperator.Parse("Title='Flying'"));
                XPCollection groupItems = (XPCollection)g1.GetMemberValue("Items");
                System.Diagnostics.Debug.Assert(groupItems.Count == 2);
                Supplier     s1           = session.FindObject <Supplier>(CriteriaOperator.Parse("CompanyName='Acme'"));
                XPCollection acmeProducts = (XPCollection)s1.GetMemberValue("Products");
                System.Diagnostics.Debug.Assert(acmeProducts.Count == 2);
                Product p3 = session.FindObject <Product>(CriteriaOperator.Parse("Name='Saucer'"));
                System.Diagnostics.Debug.Assert(((Supplier)miSupplier.GetValue(p3)).CompanyName == "Zorq");
            }
        }
Ejemplo n.º 54
0
        public List <TFCodeCaseProcessInCodeTaskChain> GetListCodeCaseProcessInCodeTaskChain()
        {
            var xpcCodeCaseProcessInCodeTaskChain = new XPCollection <TFCodeCaseProcessInCodeTaskChain>(TheUow, CriteriaOperator.Parse("g_CodeTaskGuid = ?", g_ID));

            return(xpcCodeCaseProcessInCodeTaskChain.ToList());
        }
Ejemplo n.º 55
0
        public void ValidateVoucherForBookingEntry(Guid VouchesId)
        {
            using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
            {
                try
                {
                    NAS.DAL.Vouches.Vouches voucher = uow.GetObjectByKey <NAS.DAL.Vouches.Vouches>(VouchesId);

                    if (voucher == null)
                    {
                        throw new Exception("The Vouches is not exist in db");
                    }

                    string AllocationTypeCode = string.Empty;

                    if (voucher is NAS.DAL.Vouches.PaymentVouches)
                    {
                        AllocationTypeCode = "VOUCHER_PAYMENT";
                    }
                    if (voucher is NAS.DAL.Vouches.ReceiptVouches)
                    {
                        AllocationTypeCode = "VOUCHER_RECEIPT";
                    }

                    XPCollection <VoucherAllocation> voucherAllocationLst = new XPCollection <VoucherAllocation>(uow,
                                                                                                                 new BinaryOperator("VouchesId", voucher, BinaryOperatorType.Equal));

                    if (voucherAllocationLst == null || voucherAllocationLst.Count == 0)
                    {
                        throw new Exception(string.Format("Thông tin hạch toán của phiếu {0} '{1}' chưa có dòng bút toán nào nên không thể hạch toán",
                                                          AllocationTypeCode.Equals("VOUCHER_PAYMENT") ? "Chi" : "Thu", voucher.Code));
                    }

                    foreach (VoucherAllocation va in voucherAllocationLst)
                    {
                        double sumOfDebit  = 0;
                        double sumOfCredit = 0;

                        foreach (VoucherAllocationBookingAccount vaba in va.VoucherAllocationBookingAccounts)
                        {
                            sumOfDebit  += vaba.Debit;
                            sumOfCredit += vaba.Credit;
                        }

                        if (sumOfDebit != sumOfCredit)
                        {
                            throw new Exception(string.Format("Thông tin hạch toán của phiếu {0} '{1}' chưa cân đối ở mã bút toán '{2}'",
                                                              AllocationTypeCode.Equals("VOUCHER_PAYMENT") ? "Chi" : "Thu", voucher.Code, va.Code));
                        }

                        if (va.Amount != sumOfDebit || va.Amount != sumOfCredit)
                        {
                            throw new Exception(string.Format("Thông tin hạch toán của phiếu {0} '{1}' chưa phân bổ đủ tại mã bút toán '{2}'",
                                                              AllocationTypeCode.Equals("VOUCHER_PAYMENT") ? "Chi" : "Thu", voucher.Code, va.Code));
                        }
                    }
                }
                catch
                {
                    //uow.ExplicitRollbackTransaction();
                    throw;
                }
            }
        }
Ejemplo n.º 56
0
        private void InitB02dnData()
        {
            XPCollection <FinancialBusinessResult_Fact> FinancialBusinessResult_Facts = new XPCollection <FinancialBusinessResult_Fact>(m_Session);

            if (FinancialBusinessResult_Facts.Count == 0)
            {
                //1
                FinancialBusinessResult_Fact financialBusinessResult_Fact = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "1. Doanh thu bán hàng và cung cấp dịch vụ";
                financialBusinessResult_Fact.Code          = "01";
                financialBusinessResult_Fact.Description   = "VI.25";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "911";
                financialBusinessResult_Fact.CreditAccount = "511,512";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //2
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "2. Các khoản giảm trừ doanh thu";
                financialBusinessResult_Fact.Code          = "02";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "521,531,532";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //3
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "3. Doanh thu thuần về bán hàng và cung cấp dịch vụ (10=01-02)";
                financialBusinessResult_Fact.Code          = "10";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "01-02";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //4
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "4. Giá vốn hàng bán";
                financialBusinessResult_Fact.Code          = "11";
                financialBusinessResult_Fact.Description   = "VI.27";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "611,621,622,623,627,631,632";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();


                //5
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "5. Lợi nhuận gộp về bán hàng và cung cấp dịch vụ(20=10-11)";
                financialBusinessResult_Fact.Code          = "20";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "10-11";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //6
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "6. Doanh thu hoạt động tài chính";
                financialBusinessResult_Fact.Code          = "21";
                financialBusinessResult_Fact.Description   = "VI.26";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "911";
                financialBusinessResult_Fact.CreditAccount = "515";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //7
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "7. Chi phí tài chính";
                financialBusinessResult_Fact.Code          = "22";
                financialBusinessResult_Fact.Description   = "VI.28";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "635";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "- Trong đó : Chi phí lãi vay";
                financialBusinessResult_Fact.Code          = "23";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //8
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "8. Chi phí bán hàng";
                financialBusinessResult_Fact.Code          = "24";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "641";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();


                //9
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "9. Chi phí quản lý doanh nghiệp";
                financialBusinessResult_Fact.Code          = "25";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "642";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();


                //10
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "10. Lợi nhuận thuần từ hoạt động kinh doanh (30=20+(21-22)-(24+25))";
                financialBusinessResult_Fact.Code          = "30";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "20+21-22-24-25";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //11
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "11. Thu nhập khác";
                financialBusinessResult_Fact.Code          = "31";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "911";
                financialBusinessResult_Fact.CreditAccount = "711";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //12
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "12. Chi phí khác";
                financialBusinessResult_Fact.Code          = "32";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "811";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //13
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "13. Lợi nhuận khác (40=31-32)";
                financialBusinessResult_Fact.Code          = "40";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "31-32";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //14
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "14. Tổng lợi nhuận kế toán trước thuế (50=30+40)";
                financialBusinessResult_Fact.Code          = "50";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "30+40";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //15
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "15. Chi phí thuế TNDN hiện hành";
                financialBusinessResult_Fact.Code          = "51";
                financialBusinessResult_Fact.Description   = "VI.30";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "911";
                financialBusinessResult_Fact.CreditAccount = "3334";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();

                //16
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "16. Chi phí thuế TNDN hoãn lại";
                financialBusinessResult_Fact.Code          = "52";
                financialBusinessResult_Fact.Description   = "VI.30";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "3334";
                financialBusinessResult_Fact.CreditAccount = "911";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();


                //17
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "17. Lợi nhuận sau thuế thu nhập doanh nghiệp (60=50-51-52)";
                financialBusinessResult_Fact.Code          = "60";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "50-51-52";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();


                //18
                financialBusinessResult_Fact               = new FinancialBusinessResult_Fact(m_Session);
                financialBusinessResult_Fact.Name          = "18. Lãi cơ bản trên cổ phiếu (*)";
                financialBusinessResult_Fact.Code          = "70";
                financialBusinessResult_Fact.Description   = "";
                financialBusinessResult_Fact.Balance       = 0;
                financialBusinessResult_Fact.LastBalance   = 0;
                financialBusinessResult_Fact.DebitAccount  = "";
                financialBusinessResult_Fact.CreditAccount = "";
                financialBusinessResult_Fact.Expresstion   = "";
                financialBusinessResult_Fact.Detail        = false;
                financialBusinessResult_Fact.RowStatus     = 1;

                financialBusinessResult_Fact.Save();
            }
        }
Ejemplo n.º 57
0
        public bool GenerateTemplateVoucherForBookingEntry(Guid VouchesId)
        {
            using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
            {
                try
                {
                    NAS.DAL.Vouches.Vouches voucher = uow.GetObjectByKey <NAS.DAL.Vouches.Vouches>(VouchesId);

                    if (voucher == null)
                    {
                        throw new Exception("The Vouches is not exist in db");
                    }

                    string AllocationTypeCode = string.Empty;

                    if (voucher is NAS.DAL.Vouches.PaymentVouches)
                    {
                        AllocationTypeCode = "VOUCHER_PAYMENT";
                    }
                    if (voucher is NAS.DAL.Vouches.ReceiptVouches)
                    {
                        AllocationTypeCode = "VOUCHER_RECEIPT";
                    }

                    XPCollection <VoucherAllocation> voucherAllocationLst = new XPCollection <VoucherAllocation>(uow,
                                                                                                                 new BinaryOperator("VouchesId", voucher, BinaryOperatorType.Equal));

                    XPCollection <Allocation> allocationsTemplate = new XPCollection <Allocation>(uow,
                                                                                                  new BinaryOperator("AllocationTypeId.Code", AllocationTypeCode, BinaryOperatorType.Equal));

                    if (voucherAllocationLst != null && voucherAllocationLst.Count > 0)
                    {
                        foreach (VoucherAllocation va in voucherAllocationLst)
                        {
                            IEnumerable <Allocation> allocations = allocationsTemplate.Where(t => t == va.AllocationId);
                            if (allocations != null && allocations.Count <Allocation>() <= 0)
                            {
                                continue;
                            }

                            if (va.VoucherAllocationBookingAccounts != null && va.VoucherAllocationBookingAccounts.Count > 0)
                            {
                                continue;
                            }

                            foreach (AllocationAccountTemplate aat in va.AllocationId.AllocationTemplates)
                            {
                                VoucherAllocationBookingAccount vaba = new VoucherAllocationBookingAccount(uow);
                                vaba.AccountId           = aat.AccountId;
                                vaba.VoucherAllocationId = va;
                            }
                        }
                    }
                    uow.CommitChanges();
                    return(true);
                }
                catch
                {
                    //uow.ExplicitRollbackTransaction();
                    throw;
                }
            }
        }
 public OrderTemplate(Session s)
 {
     _Services = new XPCollection <Service>(s);
 }
Ejemplo n.º 59
0
        public void load_data()
        {
            WebModule.Accounting.Report.S04b10_DN s04b10_dn = new Report.S04b10_DN();

            #region tham số truyền
            int    month    = Int32.Parse(this.hS04b10DN_month.Get("month_id").ToString());
            int    year     = Int32.Parse(this.hS04b10DN_year.Get("year_id").ToString());
            string owner    = "QUASAPHARCO";
            string fAccount = "157";
            //string asset = "";
            #endregion

            //try
            //{
            #region object
            MonthDim    md  = session.FindObject <MonthDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", month)));
            YearDim     yd  = session.FindObject <YearDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", year)));
            OwnerOrgDim ood = session.FindObject <OwnerOrgDim>(CriteriaOperator.Parse(String.Format("Code='{0}'",
                                                                                                    owner)));
            int CorrespondFinancialAccountDimId_default = CorrespondFinancialAccountDim.GetDefault(session,
                                                                                                   CorrespondFinancialAccountDimEnum.NAAN_DEFAULT).CorrespondFinancialAccountDimId;
            string rowStatusActive = Utility.Constant.ROWSTATUS_ACTIVE.ToString();
            XPCollection <FinancialAccountDim> f_c_FinancialAccountDim = new XPCollection <FinancialAccountDim>(session,
                                                                                                                CriteriaOperator.Parse(String.Format("Code like '{0}%' AND RowStatus='{1}'", fAccount, rowStatusActive)));
            #endregion

            #region display label report
            s04b10_dn.xrMonth.Text = month.ToString();
            s04b10_dn.xrYear.Text  = year.ToString();

            // số dư đẩu và cuối kì
            double no_dau_ki = 0, no_cuoi_ki = 0;
            if (f_c_FinancialAccountDim.Count != 0)
            {
                foreach (FinancialAccountDim each_tk in f_c_FinancialAccountDim)
                {
                    if (md != null && yd != null && ood != null)
                    {
                        GoodsInTransitForSaleSummary_Fact FinancialSummary_Fact =
                            session.FindObject <GoodsInTransitForSaleSummary_Fact>(CriteriaOperator.Parse(
                                                                                       String.Format("MonthDimId='{0}' AND "
                                                                                                     + "YearDimId='{1}' AND "
                                                                                                     + "OwnerOrgDimId='{2}' AND "
                                                                                                     + "FinancialAccountDimId='{3}' AND "
                                                                                                     + "RowStatus='{4}'",
                                                                                                     md.MonthDimId,
                                                                                                     yd.YearDimId,
                                                                                                     ood.OwnerOrgDimId,
                                                                                                     each_tk.FinancialAccountDimId,
                                                                                                     rowStatusActive
                                                                                                     )));
                        if (FinancialSummary_Fact != null)
                        {
                            no_dau_ki  += (double)FinancialSummary_Fact.BeginDebitBalance;
                            no_cuoi_ki += (double)FinancialSummary_Fact.EndDebitBalance;
                        }
                    }
                }
            }

            s04b10_dn.xrdauki.Text  = String.Format("{0:#,#}", no_dau_ki);
            s04b10_dn.xrCuoiKi.Text = String.Format("{0:#,#}", no_cuoi_ki);
            #endregion

            #region header và table báo cáo
            grid_header();
            DataTable datatable = table_pri();
            #endregion

            #region all row list_inventory
            List <int> list_inventory = new List <int>();
            if (f_c_FinancialAccountDim.Count != 0)
            {
                foreach (FinancialAccountDim each_tk in f_c_FinancialAccountDim)
                {
                    if (md != null && yd != null && ood != null)
                    {
                        GoodsInTransitForSaleSummary_Fact GoodsSummary_Fact =
                            session.FindObject <GoodsInTransitForSaleSummary_Fact>(CriteriaOperator.Parse(
                                                                                       String.Format("MonthDimId='{0}' AND "
                                                                                                     + "YearDimId='{1}' AND "
                                                                                                     + "OwnerOrgDimId='{2}' AND "
                                                                                                     + "FinancialAccountDimId='{3}' AND "
                                                                                                     + "RowStatus='{4}'",
                                                                                                     md.MonthDimId,
                                                                                                     yd.YearDimId,
                                                                                                     ood.OwnerOrgDimId,
                                                                                                     each_tk.FinancialAccountDimId,
                                                                                                     rowStatusActive
                                                                                                     )));
                        if (GoodsSummary_Fact != null)
                        {
                            ////
                            XPCollection <GoodsInTransitForSaleDetail> collec_detail =
                                new XPCollection <GoodsInTransitForSaleDetail>(session, CriteriaOperator.Parse(
                                                                                   String.Format("GoodsInTransitForSaleSummary_FactId='{0}' AND "
                                                                                                 + "Credit>0 AND "
                                                                                                 + "CorrespondFinancialAccountDimId!='{1}' AND "
                                                                                                 + "RowStatus='{2}'",
                                                                                                 GoodsSummary_Fact.GoodsInTransitForSaleSummary_FactId,
                                                                                                 CorrespondFinancialAccountDimId_default,
                                                                                                 rowStatusActive
                                                                                                 )));
                            if (collec_detail.Count != 0)
                            {
                                foreach (GoodsInTransitForSaleDetail each_detail in collec_detail)
                                {
                                    if (!list_inventory.Contains(each_detail.InventoryCommandDimId.InventoryCommandDimId))
                                    {
                                        list_inventory.Add(each_detail.InventoryCommandDimId.InventoryCommandDimId);
                                    }
                                }
                            }
                            ////
                            collec_detail =
                                new XPCollection <GoodsInTransitForSaleDetail>(session, CriteriaOperator.Parse(
                                                                                   String.Format("GoodsInTransitForSaleSummary_FactId='{0}' AND "
                                                                                                 + "Debit>0 AND "
                                                                                                 + "CorrespondFinancialAccountDimId!='{1}' AND "
                                                                                                 + "RowStatus='{2}'",
                                                                                                 GoodsSummary_Fact.GoodsInTransitForSaleSummary_FactId,
                                                                                                 CorrespondFinancialAccountDimId_default,
                                                                                                 rowStatusActive
                                                                                                 )));
                            if (collec_detail.Count != 0)
                            {
                                foreach (GoodsInTransitForSaleDetail each_detail in collec_detail)
                                {
                                    if (!list_inventory.Contains(each_detail.InventoryCommandDimId.InventoryCommandDimId))
                                    {
                                        list_inventory.Add(each_detail.InventoryCommandDimId.InventoryCommandDimId);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region đổ dữ liệu
            DataRow dr;
            int     STTu = 1;
            // từng dòng
            foreach (int each_row in list_inventory)
            {
                #region object inventory
                InventoryCommandDim inventory = session.FindObject <InventoryCommandDim>(
                    CriteriaOperator.Parse(String.Format("InventoryCommandDimId='{0}' AND "
                                                         + "RowStatus='{1}'",
                                                         each_row,
                                                         rowStatusActive
                                                         )));
                #endregion

                dr               = datatable.NewRow();
                dr["stt"]        = STTu++;
                dr["so_hieu"]    = inventory.Code;
                dr["ngay_thang"] = String.Format("{0:dd/MM/yyyy}", inventory.IssueDate);
                dr["dien_giai"]  = inventory.Description;

                // từng cột
                #region credit correspond
                double cong_no_TT = 0, sum_quantity = 0;
                foreach (string header_column in header_credit_correspond())
                {
                    double cell = 0, quantity = 0;;
                    //
                    CorrespondFinancialAccountDim CorrespondId = session.FindObject <CorrespondFinancialAccountDim>(
                        CriteriaOperator.Parse(String.Format("Code='{0}'", header_column)));
                    //
                    if (f_c_FinancialAccountDim.Count != 0)
                    {
                        foreach (FinancialAccountDim each_tk in f_c_FinancialAccountDim)
                        {
                            if (md != null && yd != null && ood != null)
                            {
                                GoodsInTransitForSaleSummary_Fact GoodsSummary_Fact =
                                    session.FindObject <GoodsInTransitForSaleSummary_Fact>(CriteriaOperator.Parse(
                                                                                               String.Format("MonthDimId='{0}' AND "
                                                                                                             + "YearDimId='{1}' AND "
                                                                                                             + "OwnerOrgDimId='{2}' AND "
                                                                                                             + "FinancialAccountDimId='{3}' AND "
                                                                                                             + "RowStatus='{4}'",
                                                                                                             md.MonthDimId,
                                                                                                             yd.YearDimId,
                                                                                                             ood.OwnerOrgDimId,
                                                                                                             each_tk.FinancialAccountDimId,
                                                                                                             rowStatusActive
                                                                                                             )));
                                if (GoodsSummary_Fact != null)
                                {
                                    XPCollection <GoodsInTransitForSaleDetail> collec_detail_credit =
                                        new XPCollection <GoodsInTransitForSaleDetail>(session, CriteriaOperator.Parse(
                                                                                           String.Format("GoodsInTransitForSaleSummary_FactId='{0}' AND "
                                                                                                         + "Credit>0 AND "
                                                                                                         + "CorrespondFinancialAccountDimId!='{1}' AND "
                                                                                                         + "RowStatus='{2}' AND "
                                                                                                         + "InventoryCommandDimId='{3}' AND "
                                                                                                         + "CorrespondFinancialAccountDimId='{4}'",
                                                                                                         GoodsSummary_Fact.GoodsInTransitForSaleSummary_FactId,
                                                                                                         CorrespondFinancialAccountDimId_default,
                                                                                                         rowStatusActive,
                                                                                                         each_row,
                                                                                                         CorrespondId.CorrespondFinancialAccountDimId
                                                                                                         )));
                                    if (collec_detail_credit.Count != 0)
                                    {
                                        foreach (GoodsInTransitForSaleDetail each_detail in collec_detail_credit)
                                        {
                                            cell         += (double)each_detail.Credit;
                                            cong_no_TT   += (double)each_detail.Credit;
                                            quantity     += each_detail.Quantity;
                                            sum_quantity += each_detail.Quantity;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    //
                    dr[header_column + "_SL_co"] = quantity;
                    dr[header_column + "_GT_co"] = cell;
                }
                dr["cong_no_SL"] = sum_quantity;
                dr["cong_no_GT"] = cong_no_TT;
                #endregion

                // từng cột
                #region debit correspond
                double cong_co_TT = 0, sum_Quantity = 0;
                foreach (string header_column in header_debit_correspond())
                {
                    double cell = 0, quantity = 0;
                    //
                    CorrespondFinancialAccountDim CorrespondId = session.FindObject <CorrespondFinancialAccountDim>(
                        CriteriaOperator.Parse(String.Format("Code='{0}'", header_column)));
                    //
                    if (f_c_FinancialAccountDim.Count != 0)
                    {
                        foreach (FinancialAccountDim each_tk in f_c_FinancialAccountDim)
                        {
                            if (md != null && yd != null && ood != null)
                            {
                                GoodsInTransitForSaleSummary_Fact GoodsSummary_Fact =
                                    session.FindObject <GoodsInTransitForSaleSummary_Fact>(CriteriaOperator.Parse(
                                                                                               String.Format("MonthDimId='{0}' AND "
                                                                                                             + "YearDimId='{1}' AND "
                                                                                                             + "OwnerOrgDimId='{2}' AND "
                                                                                                             + "FinancialAccountDimId='{3}' AND "
                                                                                                             + "RowStatus='{4}'",
                                                                                                             md.MonthDimId,
                                                                                                             yd.YearDimId,
                                                                                                             ood.OwnerOrgDimId,
                                                                                                             each_tk.FinancialAccountDimId,
                                                                                                             rowStatusActive
                                                                                                             )));
                                if (GoodsSummary_Fact != null)
                                {
                                    XPCollection <GoodsInTransitForSaleDetail> collec_detail_debit =
                                        new XPCollection <GoodsInTransitForSaleDetail>(session, CriteriaOperator.Parse(
                                                                                           String.Format("GoodsInTransitForSaleSummary_FactId='{0}' AND "
                                                                                                         + "Debit>0 AND "
                                                                                                         + "CorrespondFinancialAccountDimId!='{1}' AND "
                                                                                                         + "RowStatus='{2}' AND "
                                                                                                         + "InventoryCommandDimId='{3}' AND "
                                                                                                         + "CorrespondFinancialAccountDimId='{4}'",
                                                                                                         GoodsSummary_Fact.GoodsInTransitForSaleSummary_FactId,
                                                                                                         CorrespondFinancialAccountDimId_default,
                                                                                                         rowStatusActive,
                                                                                                         each_row,
                                                                                                         CorrespondId.CorrespondFinancialAccountDimId
                                                                                                         )));
                                    if (collec_detail_debit.Count != 0)
                                    {
                                        foreach (GoodsInTransitForSaleDetail each_detail in collec_detail_debit)
                                        {
                                            cell         += (double)each_detail.Debit;
                                            cong_co_TT   += (double)each_detail.Debit;
                                            quantity     += each_detail.Quantity;
                                            sum_Quantity += each_detail.Quantity;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    dr[header_column + "_SL_no"] = quantity;
                    dr[header_column + "_GT_no"] = cell;
                }
                dr["cong_co_SL"] = sum_Quantity;
                dr["cong_co_GT"] = cong_co_TT;
                #endregion

                datatable.Rows.Add(dr);
            }
            #endregion

            #region dòng cộng
            dr = datatable.NewRow();
            dr["dien_giai"] = "Cộng";

            int column_count = datatable.Columns.Count - 1;
            int row_count    = datatable.Rows.Count - 1;
            for (int c = 4; c <= column_count; c++)
            {
                double sumT = 0;
                for (int r = 1; r <= row_count; r++)
                {
                    double tt;
                    double.TryParse(datatable.Rows[r][c].ToString(), out tt);
                    sumT += tt;
                }
                dr[datatable.Columns[c]] = sumT;
            }
            datatable.Rows.Add(dr);
            #endregion

            #region out gridview
            GridView_S04b10DN.DataSource = datatable;
            GridView_S04b10DN.DataBind();
            #endregion
            //}
            //catch { }

            #region export report
            s04b10_dn.printableCC_S04b10DN.PrintableComponent = new PrintableComponentLinkBase()
            {
                Component = GridViewExporter_S04b10DN
            };
            ReportViewer_S04b10DN.Report = s04b10_dn;
            #endregion
        }
Ejemplo n.º 60
0
 public GenericCollection(XPCollection <TEntity> inner)
 {
     this.inner = inner;
     this.list  = inner;
 }