Ejemplo n.º 1
0
        public Guid insertAuditingInventoryCommand(Session session)
        {
            Guid _id = Guid.Empty;

            InventoryAuditArtifact _inventoryAuditArtifact = new InventoryAuditArtifact(session);

            return(_id);
        }
Ejemplo n.º 2
0
        // InventoryAuditUnitItem
        public Guid insertInventoryAuditUnitItem(Session session)
        {
            Guid _id = Guid.Empty;

            InventoryAuditArtifact _inventoryAuditArtifact = new InventoryAuditArtifact(session);


            return(_id);
        }
Ejemplo n.º 3
0
        protected void grdInventoryCommand_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string[] para = e.Parameters.Split('|');
            InventoryAuditArtifact _inventoryAuditArtifact = session.GetObjectByKey <InventoryAuditArtifact>(Guid.Parse(para[0]));

            if (_inventoryAuditArtifact != null)
            {
                _inventoryAuditArtifact.ApprovalStatus = Constant.APRROVE_YES;
                _inventoryAuditArtifact.Save();

                grdInventoryCommand.JSProperties.Add("cpRefreshGrid", "refresh");
            }
        }
Ejemplo n.º 4
0
        protected void grdInventoryCommand_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            e.Cancel = true;
            InventoryAuditArtifact _inventoryAuditArtifact = session.GetObjectByKey <InventoryAuditArtifact>(e.Values["InventoryCommandId"]);

            if (_inventoryAuditArtifact != null)
            {
                _inventoryAuditArtifact.RowStatus = Constant.ROWSTATUS_DELETED;
                _inventoryAuditArtifact.Save();
            }

            grdInventoryCommand.JSProperties.Add("cpRefresh", "refresh");
        }
Ejemplo n.º 5
0
        protected void grdInventoryCommand_CustomButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.VisibleIndex == -1)
            {
                return;
            }

            if (e.CellType == DevExpress.Web.ASPxGridView.GridViewTableCommandCellType.Data)
            {
                InventoryAuditArtifact row = (InventoryAuditArtifact)grdInventoryCommand.GetRow(e.VisibleIndex);
                if (e.ButtonID == "buttonApprove" && row.ApprovalStatus.ToString().Contains(Constant.APRROVE_YES))
                {
                    e.Visible = DefaultBoolean.False;
                }
            }
        }
Ejemplo n.º 6
0
 protected void grdInventoryCommand_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
 {
     if (e.Column.FieldName == "PersonName")
     {
         InventoryAuditArtifact _inventoryAuditArtifact = session.GetObjectByKey <InventoryAuditArtifact>(e.GetListSourceFieldValue("InventoryCommandId"));
         if (_inventoryAuditArtifact != null)
         {
             foreach (InventoryCommandActor ica in _inventoryAuditArtifact.InventoryCommandActors)
             {
                 if (ica.InventoryCommandActorTypeId.Name == "CHIEFCHECKING")
                 {
                     if (ica.PersonId != null)
                     {
                         e.Value = ica.PersonId.Name;
                         break;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
        public InventoryAuditArtifact getAuditingInventoryCommandById(Session session, Guid id)
        {
            InventoryAuditArtifact _inventoryAuditArtifact = session.GetObjectByKey <InventoryAuditArtifact>(id);

            return(_inventoryAuditArtifact);
        }
Ejemplo n.º 8
0
        public void load_data()
        {
            if (!hfReportAudit.Contains("id"))
            {
                return;
            }

            #region header và dòng đầu gridview
            header_column_GridView();
            DataTable data_table = table_template();
            #endregion

            // truyền tham số mã kho và mã phiếu kiểm kê
            string code_repository, code_inventory;

            InventoryAuditArtifact a = session.GetObjectByKey <InventoryAuditArtifact>(Guid.Parse(hfReportAudit.Get("id").ToString()));

            code_repository = a.InventoryId.Code; //"KHO_TNTX";
            code_inventory  = a.Code;             //"BB01";

            #region xử lý data
            int    STT             = 1;
            XPView list_ItemUnitId = new XPView(session, typeof(InventoryAuditItemUnit));
            list_ItemUnitId.AddProperty("itemUnit", "ItemUnitId", true);

            double sum_thanh_tien_kt = 0, sum_thanh_tien_kk = 0, sum_thanh_tien_thua = 0, sum_thanh_tien_thieu = 0;
            foreach (ViewRecord each_ItemUnitId in list_ItemUnitId)
            {
                XPCollection <InventoryAuditItemUnit> iaiu = new XPCollection <InventoryAuditItemUnit>(session, CriteriaOperator.Parse("ItemUnitId = '" + each_ItemUnitId["itemUnit"].ToString() + "'"));
                foreach (InventoryAuditItemUnit each_iaiu in iaiu)
                {
                    try
                    {
                        if (each_iaiu.InventoryAuditArtifactId.InventoryId.Code == code_repository && each_iaiu.InventoryAuditArtifactId.RowStatus >= 1 && each_iaiu.InventoryAuditArtifactId.Code == code_inventory) //xét kho
                        {
                            XPCollection <QualityItem> qi = each_iaiu.QualityItems;
                            double kem = 0, mat = 0;
                            foreach (QualityItem each_qi in qi)
                            {
                                if (each_qi.QualityItemType.Name == "LOSS_QUANLITY")
                                {
                                    mat += each_qi.AuditAmount;
                                }
                                else if (each_qi.QualityItemType.Name == "LESS_QUANLITY")
                                {
                                    kem += each_qi.AuditAmount;
                                }
                            }

                            double so_luong_kt       = each_iaiu.BookingAmount;
                            double so_luong_kk       = each_iaiu.RealAmount;
                            XPCollection <COGS> cogs = new XPCollection <COGS>(session, CriteriaOperator.Parse("InventoryId='" + each_iaiu.InventoryAuditArtifactId.InventoryId.InventoryId + "' AND ItemUnitId='" + each_iaiu.ItemUnitId.ItemUnitId + "'"));
                            double money;
                            try { money = cogs[0].COGSPrice; }
                            catch { money = 0; }

                            sum_thanh_tien_kk += money * so_luong_kk;
                            sum_thanh_tien_kt += money * so_luong_kt;

                            DataRow dr = data_table.NewRow();
                            dr["stt"]           = STT++;
                            dr["ten"]           = each_iaiu.ItemUnitId.ItemId.Name;
                            dr["ma_so"]         = each_iaiu.ItemUnitId.ItemId.Code;
                            dr["don_vi_tinh"]   = each_iaiu.ItemUnitId.UnitId.Name;
                            dr["don_gia"]       = money;
                            dr["so_luong_kt"]   = so_luong_kt;
                            dr["thanh_tien_kt"] = money * so_luong_kt;
                            dr["so_luong_kk"]   = so_luong_kk;
                            dr["thanh_tien_kk"] = money * so_luong_kk;
                            if (so_luong_kk > so_luong_kt)
                            {
                                dr["so_luong_thua"]   = so_luong_kk - so_luong_kt;
                                dr["thanh_tien_thua"] = money * (so_luong_kk - so_luong_kt);
                                sum_thanh_tien_thua  += money * (so_luong_kk - so_luong_kt);
                            }
                            else if (so_luong_kk < so_luong_kt)
                            {
                                dr["so_luong_thieu"]   = so_luong_kt - so_luong_kk;
                                dr["thanh_tien_thieu"] = money * (so_luong_kt - so_luong_kk);
                                sum_thanh_tien_thieu  += money * (so_luong_kt - so_luong_kk);
                            }
                            dr["tot"] = so_luong_kk - kem - mat;
                            dr["kem"] = kem;
                            dr["mat"] = mat;
                            data_table.Rows.Add(dr);
                        }
                    }
                    catch { }
                }
            }
            DataRow dr_sum = data_table.NewRow();
            dr_sum["ten"]              = "Cộng  ";
            dr_sum["thanh_tien_kt"]    = sum_thanh_tien_kt + "  ";
            dr_sum["thanh_tien_kk"]    = sum_thanh_tien_kk + "  ";
            dr_sum["thanh_tien_thua"]  = sum_thanh_tien_thua + "  ";
            dr_sum["thanh_tien_thieu"] = sum_thanh_tien_thieu + "  ";
            data_table.Rows.Add(dr_sum);

            #endregion


            #region bind data vào gridview

            xGridView.DataSource = data_table;
            xGridView.DataBind();
            #endregion

            #region xuất report

            WebModule.Warehouse.Report._05_VT _05_VT = new WebModule.Warehouse.Report._05_VT();
            xGridViewExporter.GridViewID          = "xGridView";
            _05_VT.printableCC.PrintableComponent = new PrintableComponentLinkBase()
            {
                Component = xGridViewExporter
            };
            ReportViewer.Report = _05_VT;

            #endregion
        }