Пример #1
0
        protected void btnView_Click(object sender, EventArgs e)
        {
            ProcurementData pd = new ProcurementData();
            DataSet         DS = new DataSet();

            Model.Procurement p = new Model.Procurement();

            p.CenterID = 6;//Convert.ToInt32(dpCenter.SelectedItem.Value);
            if (rdDisposal.Checked)
            {
                p.Date = Convert.ToDateTime(txtDate.Text);
                flag   = "dispose";
            }
            if (rdRecieving.Checked)
            {
                flag   = "receive";
                p.Date = Convert.ToDateTime(txtDate.Text);
            }
            p.flag = flag;
            DS     = pd.GetAllBatchWiseMilkCollectionDetails(p);
            try
            {
                rpBatchWiseMilkCollection.DataSource = DS;
                rpBatchWiseMilkCollection.DataBind();
            }
            catch { }
            uprouteList.Update();
        }
Пример #2
0
        protected void btnAddVehicle_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.VehicleMasterID = 0;
            //p.VehicleName = txtVehicleName.Text;
            p.VehicleNo        = txtVehicleNo.Text;
            p.VehicleID1       = 'V' + txtVehicleNo.Text;
            p.VehicleOwnerName = txtOwnerName.Text;
            p.OwnerEmail       = txtOwnerEmail.Text;
            p.OwnerMobileNo    = txtOwnerMobileNo.Text;
            p.TransportType    = dpTransportType.SelectedItem.Text;
            p.VehicleType      = Convert.ToInt32(dpVehicleType.SelectedItem.Value);
            p.DriverName       = txtDriverName.Text;
            p.DriverMobileNo   = txtDriverMobile.Text;
            p.OwnerBankName    = dpBankName.SelectedItem.Text;
            p.IFSCCode         = dpIfscCode.SelectedItem.Text;
            p.BranchName       = txtBranchName.Text;
            p.AccountNo        = txtAccNo.Text;
            p.RouteID          = Convert.ToInt32(dpRoute.SelectedItem.Value);
            p.tdspercentage    = Convert.ToDouble(txtTDSPercent.Text);
            p.CreatedBy        = App_code.GlobalInfo.Userid;
            if (DropDownList1.SelectedValue == "1")
            {
                p.IsActive = true;
            }
            else if (DropDownList1.SelectedValue == "2")
            {
                p.IsActive = false;
            }
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag         = "Insert";
            int Result = 0;

            Result = pd.InsertVehicleDetails(p);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Vehicle Record Add  Successfully";

                ClearTextBox();
                BindVehicleList();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #3
0
        protected void btnView_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.Date    = Convert.ToDateTime(txtDate1.Text);
            p.RouteID = Convert.ToInt32(dpRoute1.SelectedItem.Value);
            if (dpSession1.SelectedItem.Value == "0")
            {
                p.Session = "0";
            }
            else
            {
                p.Session = dpSession1.SelectedItem.Text.ToString();
            }

            DataSet DS1 = new DataSet();

            DS1 = pd.ViewMilkCollectionDetails(p);
            if (!Comman.Comman.IsDataSetEmpty(DS1))
            {
                rpMilkCollectionList.DataSource = DS1;
                rpMilkCollectionList.DataBind();
                uprouteList.Update();
            }
        }
Пример #4
0
        protected void btnupdateMilkCollection_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.MilkCollectionID = string.IsNullOrEmpty(hfMilkCollectionID.Value) ? 0 : Convert.ToInt32(hfMilkCollectionID.Value);
            p.Batch            = txtBatch.Text;
            p.Session          = dpSession.SelectedItem.Text;
            p.Date             = Convert.ToDateTime(txtDate.Text);
            p.MilkInKG         = Convert.ToDecimal(txtMilkInKG.Text);
            p.MilkInLtr        = Convert.ToDecimal(txtMilkInLtr.Text);
            p.ActualMilkInLtr  = Convert.ToDecimal(txtMilkInLtr.Text);
            p.RouteID          = Convert.ToInt32(dpRoute.SelectedItem.Value);
            p.SupplierID       = Convert.ToInt32(dpSupplier.SelectedItem.Value);
            p.FATPercentage    = Convert.ToDecimal(txtFATPercentage.Text);
            p.FATInKG          = Convert.ToDecimal(txtFATInKG.Text);
            p.CLRReading       = Convert.ToDecimal(txtCLRReading.Text);
            //p.SNF = Convert.ToDecimal(txtSNF.Text);
            p.SNFPercentage = Convert.ToDecimal(txtSNFPercentage.Text);
            p.SNFInKG       = Convert.ToDecimal(txtSNFInKG.Text);
            p.TSPercentage  = Convert.ToDecimal(txtTSPercentage.Text);
            p.TSInKg        = Convert.ToDecimal(txtTSKG.Text);
            p.MilkCan       = Convert.ToInt32(txtMilkCan.Text);
            p.CreatedBy     = App_code.GlobalInfo.Userid;
            p.Createddate   = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy    = App_code.GlobalInfo.Userid;
            p.ModifiedDate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag          = "Update";
            int Result = 0;

            Result = pd.InsertMilkCollectionDetails(p);
            if (Result > 0)
            {
                //lbltital.Text = "Add Route";
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Milk Collection Record Updated  Successfully";
                ClearTextBox();
                //BindMilkCollectionList();
                pnlError.Update();
                btnAddMilkCollection.Visible    = true;
                btnupdateMilkCollection.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #5
0
        public void DeleteVehiclebyvehicleID(int vehicleid)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.VehicleMasterID  = string.IsNullOrEmpty(hfrouteID.Value) ? 0 : Convert.ToInt32(hfrouteID.Value);
            p.VehicleName      = string.Empty;
            p.VehicleNo        = string.Empty;
            p.VehicleID1       = string.Empty;
            p.VehicleOwnerName = string.Empty;
            p.OwnerEmail       = string.Empty;
            p.OwnerMobileNo    = string.Empty;
            //p.VehicleSrNo = string.Empty;
            p.tdspercentage  = 0;
            p.VehicleType    = 0;
            p.DriverName     = string.Empty;
            p.DriverMobileNo = string.Empty;
            p.OwnerBankName  = dpBankName.SelectedItem.Text;
            p.IFSCCode       = dpIfscCode.SelectedItem.Text;
            p.BranchName     = string.Empty;
            p.AccountNo      = string.Empty;
            p.RouteID        = 0;
            p.IsActive       = false;
            p.TransportType  = dpTransportType.SelectedItem.Text;
            p.Createddate    = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy     = App_code.GlobalInfo.Userid;
            p.ModifiedDate   = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag           = "Delete";
            int Result = 0;

            Result = pd.InsertVehicleDetails(p);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Delete Updated  Successfully";
                ClearTextBox();
                BindVehicleList();
                pnlError.Update();
                btnAddVehicle.Visible    = true;
                btnupdateVehicle.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #6
0
        public void DeleteRoutebyrouteID(int rawid)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.RawMilkTarrifID = string.IsNullOrEmpty(hfrouteID.Value) ? 0 : Convert.ToInt32(hfrouteID.Value);
            //p.Category = Convert.ToInt32(Category.SelectedItem.Value);
            p.Category     = string.IsNullOrEmpty(txtCategory.Text) ? string.Empty : txtCategory.Text;
            p.TSL          = string.IsNullOrEmpty(txtTSL.Text) ? 0 : Convert.ToDecimal(txtTSL.Text);
            p.TSH          = string.IsNullOrEmpty(txtTSH.Text) ? 0 : Convert.ToDecimal(txtTSH.Text);
            p.TSRATE       = string.IsNullOrEmpty(txtTSRate.Text) ? 0 : Convert.ToDecimal(txtTSRate.Text);
            p.TS_INCR      = 0;
            p.Incentive    = string.IsNullOrEmpty(txtIncentive.Text) ? 0 : Convert.ToInt32(txtIncentive.Text);
            p.IN_FAT       = string.IsNullOrEmpty(txtIN_FAT.Text) ? 0 : Convert.ToInt32(txtIN_FAT.Text);
            p.IN_SNF       = string.IsNullOrEmpty(txtIN_SNF.Text) ? 0 : Convert.ToInt32(txtIN_SNF.Text);
            p.IN_TS        = string.IsNullOrEmpty(txtIN_TS.Text) ? 0 : Convert.ToInt32(txtIN_TS.Text);
            p.Bonus1       = string.IsNullOrEmpty(txtBonus.Text) ? 0 : Convert.ToDecimal(txtBonus.Text);
            p.Scheme       = string.IsNullOrEmpty(txtScheme.Text) ? 0 : Convert.ToDecimal(txtScheme.Text);
            p.WEF_DATE     = Convert.ToDateTime(txtWEF_DATE.Text);
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag         = "Delete";
            int Result = 0;

            Result = pd.InsertRawMilkTarrif(p);
            if (Result > 0)
            {
                //lbltital.Text = "Add Route";
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Raw Milk Tarrif Record Deleted Succefully  Successfully";
                ClearTextBox();
                BindRawMilkTerrifList();
                pnlError.Update();
                btnAddRaw.Visible    = true;
                btnupdateRaw.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #7
0
        //public void DeleteRoutebyrouteID(int routeID)
        //{

        //    Route route = new Route();
        //    RouteData routeDate = new RouteData();
        //    route.RouteID = string.IsNullOrEmpty(hfrouteID.Value) ? 0 : Convert.ToInt32(hfrouteID.Value);
        //    route.RouteCode = string.Empty;
        //    route.RouteName = string.Empty;
        //    route.ASOID = Convert.ToInt32(dpASOID.SelectedItem.Value);
        //    route.Category = Convert.ToInt32(Category.SelectedItem.Value);
        //    route.RouteDesc = string.Empty;
        //    route.CreatedBy = App_code.GlobalInfo.Userid;
        //    route.Discription = txtDesc.Text;
        //    route.IsActive = false;
        //    route.Createddate = DateTime.Now.ToString("dd-MM-yyyy");
        //    route.ModifiedBy = App_code.GlobalInfo.Userid;
        //    route.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
        //    route.flag = "Delete";
        //    int Result = 0;
        //    Result = routeDate.InsertMilkCollectionRoute(route);
        //    if (Result > 0)
        //    {

        //        divDanger.Visible = false;
        //        divwarning.Visible = false;
        //        divSusccess.Visible = true;
        //        lblSuccess.Text = "Delete Updated  Successfully";
        //        ClearTextBox();
        //        BindRouteList();
        //        pnlError.Update();
        //        btnAddRout.Visible = true;
        //        btnupdateroute.Visible = false;
        //        upMain.Update();
        //        uprouteList.Update();
        //    }
        //    else
        //    {
        //        divDanger.Visible = false;
        //        divwarning.Visible = true;
        //        divSusccess.Visible = false;
        //        lblwarning.Text = "Please Contact to Site Admin";
        //        pnlError.Update();

        //    }
        //}
        protected void btnupdateVeh_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.VehicleID = string.IsNullOrEmpty(hfrouteID.Value) ? 0 : Convert.ToInt32(hfrouteID.Value);
            // p.SrNo = txtSrNo.Text;
            p.VehicleType = Convert.ToInt16(dpVehicleType.SelectedItem.Value);
            p.Bata        = Convert.ToDouble(txtBata.Text);
            p.KMLow       = Convert.ToDouble(txtKMLow.Text);
            p.KMHigh      = Convert.ToDouble(txtKMHigh.Text);
            //p.V201To250 = Convert.ToDouble(txt201To250.Text);
            //p.V251To300 = Convert.ToDouble(txt251To300.Text);
            //p.KMGreaterThan300 = Convert.ToDouble(txtKMGreater300.Text);
            p.Amount       = Convert.ToDouble(txtAmount.Text);
            p.Discription  = txtDesc.Text;
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag         = "Update";
            int Result = 0;

            Result = pd.InsertVehicleMaster(p);
            if (Result > 0)
            {
                //lbltital.Text = "Add Route";
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Vehicle Record Updated  Successfully";
                ClearTextBox();
                BindVehicleList();
                pnlError.Update();
                btnAddVeh.Visible    = true;
                btnupdateVeh.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #8
0
        protected void benUpdateVehicleType_Click(object sender, EventArgs e)
        {
            pd = new ProcurementData();
            p  = new Model.Procurement();
            int Result = 0;

            p.VehicleType     = string.IsNullOrEmpty(hfBrandId.Value) ? 0 : Convert.ToInt32(hfBrandId.Value);
            p.VehicleTypeName = txtVehicleType.Text;
            if (dpStatus.SelectedItem.Value == "1")
            {
                p.IsActive = true;
            }
            if (dpStatus.SelectedItem.Value == "0")
            {
                p.IsActive = false;
            }
            p.flag = "Update";
            Result = pd.InsertVehicleType(p);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Vehicle Model Updated  Successfully";
                GetVehicleType();

                upMain.Update();

                pnlError.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "   Please Contact to Site Admin";

                pnlError.Update();
            }
        }
Пример #9
0
        protected void btnAddRaw_Click(object sender, EventArgs e)
        {
            decimal tsl = Convert.ToDecimal(txtTSL.Text);
            decimal tsh = Convert.ToDecimal(txtTSH.Text);

            if (tsl < tsh)
            {
                Model.Procurement p  = new Model.Procurement();
                ProcurementData   pd = new ProcurementData();
                p.RawMilkTarrifID = 0;
                //p.Category = Convert.ToInt32(Category.SelectedItem.Value);
                p.Category     = string.IsNullOrEmpty(txtCategory.Text) ? string.Empty : (txtCategory.Text);
                p.TSL          = Convert.ToDecimal(txtTSL.Text);
                p.TSH          = Convert.ToDecimal(txtTSH.Text);
                p.TSRATE       = Convert.ToDecimal(txtTSRate.Text);
                p.TS_INCR      = 0;
                p.Incentive    = string.IsNullOrEmpty(txtIncentive.Text) ? 0 : Convert.ToInt32(txtIncentive.Text);
                p.IN_FAT       = string.IsNullOrEmpty(txtIN_FAT.Text) ? 0 : Convert.ToInt32(txtIN_FAT.Text);
                p.IN_SNF       = string.IsNullOrEmpty(txtIN_SNF.Text) ? 0 : Convert.ToInt32(txtIN_SNF.Text);
                p.IN_TS        = string.IsNullOrEmpty(txtIN_TS.Text) ? 0 : Convert.ToInt32(txtIN_TS.Text);
                p.Bonus1       = string.IsNullOrEmpty(txtBonus.Text) ? 0 : Convert.ToDecimal(txtBonus.Text);
                p.Description  = string.IsNullOrEmpty(txtDescription.Text) ? string.Empty : (txtDescription.Text);
                p.Scheme       = string.IsNullOrEmpty(txtScheme.Text) ? 0 : Convert.ToDecimal(txtScheme.Text);
                p.WEF_DATE     = Convert.ToDateTime(txtWEF_DATE.Text);
                p.CreatedBy    = App_code.GlobalInfo.Userid;
                p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
                p.ModifiedBy   = App_code.GlobalInfo.Userid;
                p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
                p.flag         = "Insert";
                int Result = 0;
                DS = pd.CheckAvailability(p);
                if (Comman.Comman.IsDataSetEmpty(DS))
                {
                    Result = pd.InsertRawMilkTarrif(p);
                    if (Result > 0)
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = false;
                        divSusccess.Visible = true;
                        lblSuccess.Text     = "Raw Milk Tarrif Record Add  Successfully";

                        ClearTextBox();
                        BindRawMilkTerrifList();
                        pnlError.Update();
                        upMain.Update();
                        uprouteList.Update();
                    }
                    else
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = true;
                        divSusccess.Visible = false;
                        lblwarning.Text     = "Please Contact to Site Admin";
                        pnlError.Update();
                    }
                }
                else
                {
                    divDanger.Visible   = false;
                    divwarning.Visible  = true;
                    divSusccess.Visible = false;
                    lblwarning.Text     = "Same Record is Already Avaialble";
                    pnlError.Update();
                }
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "TSL must be a less than TSH";
                pnlError.Update();
            }
        }
Пример #10
0
        protected void btnClick_btnAddCollection(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.CenterID   = 0;
            p.CenterCode = txtCenterCode.Text;
            p.CenterName = txtCenterName.Text;
            //p.RouteID = Convert.ToInt32(dpRoute.SelectedValue);
            p.PhoneNo       = txtTelephone.Text;
            p.MobileNo      = txtMobile.Text;
            p.EmailID       = txtEmail.Text;
            p.Address1      = txtAddress1.Text;
            p.Address2      = txtAddress2.Text;
            p.Address3      = txtAddress3.Text;
            p.City          = dpCity.SelectedItem.Text;
            p.District      = dpDistrict.SelectedItem.Text;
            p.State         = dpState.SelectedItem.Text;
            p.Country       = dpCountry.SelectedItem.Text;
            p.ContactPerson = Convert.ToInt32(dpContactPerson.SelectedValue);
            p.BMC           = string.IsNullOrEmpty(txtBMC.Text) ? 0 : Convert.ToInt32(txtBMC.Text);////////////////
            p.MilkCan       = string.IsNullOrEmpty(txtMilkCan.Text) ? 0 : Convert.ToInt32(txtMilkCan.Text);
            p.Silo          = string.IsNullOrEmpty(txtSilo.Text) ? 0 : Convert.ToInt32(txtSilo.Text);
            if (rdETPYes.Checked)
            {
                p.ETP = true;
            }
            else
            {
                p.ETP = false;
            }
            if (rdLABYes.Checked)
            {
                p.LAB = true;
            }
            else
            {
                p.LAB = false;
            }
            if (rdIBTYes.Checked)
            {
                p.IBT = true;
            }
            else
            {
                p.IBT = false;
            }
            if (rdStoreYes.Checked)
            {
                p.Store = true;
            }
            else
            {
                p.Store = false;
            }
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            if (rdYes.Checked)
            {
                p.FreezerAvailable = true;
                p.FreezerModel     = txtFreezerModel.Text;
                p.Quantity         = Convert.ToInt32(txtQuantity.Text);
            }
            if (rdNo.Checked)
            {
                p.FreezerAvailable = false;
                p.FreezerModel     = "";
                p.Quantity         = 0;
            }
            if (DropDownList1.SelectedValue == "1")
            {
                p.IsActive = true;
            }
            if (DropDownList1.SelectedValue == "2")
            {
                p.IsActive = false;
            }
            p.flag = "Insert";
            int Result = 0;

            Result = pd.InsertMilkCenter(p);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Milk Center Add  Successfully";

                ClearTextBox();
                BindCollectionCenter();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #11
0
        public void DeleteCenterByCenterID(int CenterID)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.CenterID   = string.IsNullOrEmpty(hfcenterID.Value) ? 0 : Convert.ToInt32(hfcenterID.Value);
            p.CenterCode = string.Empty;
            p.CenterName = string.Empty;
            //p.RouteID = 0;
            p.PhoneNo       = string.Empty;
            p.MobileNo      = string.Empty;
            p.EmailID       = string.Empty;
            p.Address1      = string.Empty;
            p.Address2      = string.Empty;
            p.Address3      = string.Empty;
            p.City          = dpCity.SelectedItem.Text;
            p.District      = dpDistrict.SelectedItem.Text;
            p.State         = dpState.SelectedItem.Text;
            p.Country       = dpCountry.SelectedItem.Text;
            p.ContactPerson = Convert.ToInt32(dpContactPerson.SelectedValue);
            p.BMC           = 0;
            p.MilkCan       = 0;
            p.Silo          = 0;

            p.ETP = false;

            p.ETP = false;

            p.IBT = false;

            p.Store        = false;
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");

            p.FreezerAvailable = false;
            p.FreezerModel     = "";
            p.Quantity         = 0;

            p.IsActive = false;
            p.flag     = "Delete";
            int Result = 0;

            Result = pd.InsertMilkCenter(p);
            if (Result > 0)
            {
                //lbltital.Text = "Add Route";
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Record Deleted  Successfully";
                ClearTextBox();
                BindCollectionCenter();
                pnlError.Update();
                btnAddCollection.Visible    = true;
                btnupdateCollection.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #12
0
        protected void Report(string flag)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            p.CollectionID = 6;//Convert.ToInt32(dpCenter.SelectedItem.Value);
            p.RouteID      = Convert.ToInt32(dpRoute.SelectedItem.Value);
            p.FomDate      = Convert.ToDateTime(txtFromDate.Text);
            p.ToDate       = Convert.ToDateTime(txtToDate.Text);
            if (dpSession.SelectedItem.Value == "0")
            {
                p.Session = null;
            }
            else
            {
                p.Session = dpSession.SelectedItem.Text.ToString();
            }

            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString();
            p.flag         = flag;
            DataSet DS1 = new DataSet();

            DS1 = pd.CalculateBill(p);

            string result = string.Empty;

            if (!Comman.Comman.IsDataSetEmpty(DS1))
            {
                StringBuilder sb = new StringBuilder();


                sb.Append("<style type='text / css'>");
                sb.Append(".tg  { border - collapse:collapse; border - spacing:0; border: none; } .dispnone {display:none;} ");
                sb.Append("</style>");
                sb.Append("<table class='tg style1' style='page-break-inside:avoid; align:center;'>");
                sb.Append("<colgroup>");
                sb.Append("<col style = 'width:50px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:200px'>");
                sb.Append("<col style = 'width:50px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("<col style = 'width:100px'>");
                sb.Append("</colgroup>");

                sb.Append("<tr>");
                sb.Append("<th class='tg-yw4l' rowspan='2'>");
                sb.Append("<img src='/Theme/img/logo1.png' class='img-circle' alt='Logo' width='50px' hight='50px'>");
                sb.Append("</th>");

                sb.Append("<th class='tg-baqh' colspan='11' style='text-align:center'>");
                if (Session["CollectionCenterLoggedIn"] != null)
                {
                    sb.Append("<b>" + Session["CollectionCenterLoggedIn"].ToString() + "</b>");
                }
                else
                {
                    sb.Append("<b>Nanjil Integrated Dairy Development, Mulagumoodu, K.K.Dt.</b>");
                }
                sb.Append("</th>");

                sb.Append("<th class='tg-yw4l' style='text-align:right'>");

                sb.Append("TIN:330761667331<br>");
                sb.Append("</th>");
                sb.Append("</tr>");

                sb.Append("<tr style='border-bottom:1px solid'>");
                sb.Append("<td class='tg-yw4l' colspan='11' style='text-align:center'>");

                sb.Append("<b><u>Raw Milk Purchase Report </u></b> <br/>");
                sb.Append("</td>");

                sb.Append("<td class='tg-yw4l' style='text-align:right'>");

                sb.Append("PH:248370,248605");

                sb.Append("</td>");
                sb.Append("</tr>");
                sb.Append("<tr style='border-bottom:1px solid'>");

                sb.Append(" <td colspan='2' style='text-align:left'>");
                sb.Append("Session :" + dpSession.SelectedItem.Text);
                sb.Append("</td>");

                sb.Append(" <td colspan='3' style='text-align:left'>");
                sb.Append("Date :" + DateTime.Now.ToString());
                sb.Append("</td>");

                sb.Append("<td colspan='3' style='text-align:center'>");
                sb.Append(App_code.GlobalInfo.UserName);
                sb.Append("</td>");
                sb.Append("<td colspan='3'>");
                sb.Append(dpRoute.SelectedItem.Text.ToString());
                sb.Append("</td>");

                sb.Append("<td style='text-align:right'>");
                sb.Append(Convert.ToDateTime(txtFromDate.Text).ToString("dd-MM-yyyy"));
                sb.Append("</td>");
                sb.Append("<td style='text-align:right'>");
                sb.Append(Convert.ToDateTime(txtToDate.Text).ToString("dd-MM-yyyy"));
                sb.Append("</td>");

                sb.Append("</td>");
                sb.Append("</tr>");


                decimal milkinkg       = 0;
                decimal totalmilkinkg  = 0;
                decimal milkinltr      = 0;
                decimal totalmilkinltr = 0;
                double  fatinper       = 0.00;
                double  totalfatinper  = 0.00;

                double snf      = 0.00;
                double totalsnf = 0.00;

                double ts      = 0.00;
                double totalts = 0.00;

                double rpl      = 0.00;
                double totalrpl = 0.00;

                double Amount   = 0.00;
                double amt      = 0.00;
                double totalamt = 0.00;
                int    can      = 0;
                int    totalcan = 0;
                double clr      = 0.00;
                double totalclr = 0.00;


                decimal totmillkg  = 0;
                decimal totmilkltr = 0;
                int     totcan     = 0;

                double totamt = 0.00;
                double totrpl = 0.00;
                string Date;
                int    count     = 0;
                int    totcount  = 0;
                double Incentive = 0.00;
                double inc       = 0.00;
                double totalinc  = 0.00;
                double inc1      = 0.00;

                foreach (DataRow rows in DS1.Tables[1].Rows)
                {
                    count          = 0;
                    totalfatinper  = 0.00;
                    totalsnf       = 0.00;
                    totalmilkinkg  = 0;
                    totalmilkinltr = 0;
                    totalcan       = 0;
                    totalts        = 0.00;
                    totalclr       = 0.00;
                    totalrpl       = 0.00;
                    totalamt       = 0.00;
                    sb.Append("<tr style='border-bottom:1px solid'> <td colspan = '13'> &nbsp; </td> </tr>");
                    sb.Append("<tr style='border-bottom:1px solid'>");
                    sb.Append("<td  colspan='4' style='font-weight:bold'>");
                    Date = Convert.ToDateTime(rows["_Date"]).ToString("dd-MM-yyyy");
                    sb.Append("<b>Date : </b>" + Date.ToString());
                    sb.Append("</td>");
                    sb.Append("<td  colspan='4' style='font-weight:bold; text-align:Center' >");///////////
                    sb.Append("<b>Route : </b>" + rows["RouteName"].ToString());
                    sb.Append("</td>");
                    sb.Append("<td  colspan='5' style='font-weight:bold; text-align:right' >");
                    sb.Append("<b>Time : </b>" + rows["_Session"].ToString());
                    sb.Append("</td>");
                    sb.Append("</tr>");
                    sb.Append("<tr style='border-bottom:1px solid'>");

                    sb.Append("<td>");
                    sb.Append("<b>Sr.No.</b>");
                    sb.Append("</td>");



                    sb.Append("<td colspan='2'>");
                    sb.Append("<b>Supplier</b>");
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>Can</b>");
                    sb.Append("</td>");

                    sb.Append("<td  style='text-align:right'>");
                    sb.Append("<b>MilkInKG</b>");
                    sb.Append("</td>");

                    sb.Append("<td  style='text-align:right'>");
                    sb.Append("<b>MilkInLtr</b>");
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>CLR</b>");
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>Fat %</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>SNF %</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>TS %</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>RPL</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>Incentive</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>Amount</b>");
                    sb.Append("</td>");
                    sb.Append("</tr>");
                    sb.Append("</tr>");
                    sb.Append("<tr>");
                    foreach (DataRow row in DS1.Tables[0].Rows)
                    {
                        if (rows["_Date"].ToString() == row["_Date"].ToString())
                        {
                            if (rows["RouteName"].ToString() == row["RouteName"].ToString())
                            {
                                if (rows["_Session"].ToString() == row["_Session"].ToString())
                                {
                                    count++;

                                    sb.Append("<td>");
                                    sb.Append(count);
                                    sb.Append("</td>");



                                    sb.Append("<td colspan='2'>");
                                    sb.Append(row["Supplier"].ToString());
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { can = Convert.ToInt32(row["Can"]); } catch { can = 0; }

                                    totalcan += can;
                                    sb.Append(row["Can"].ToString());
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { milkinkg = Convert.ToDecimal(row["MilkInKG"]); } catch { milkinkg = 0; }

                                    totalmilkinkg += milkinkg;
                                    sb.Append(Convert.ToDecimal(milkinkg).ToString("0.0"));
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { milkinltr = Convert.ToDecimal(row["MilkInLtr"]); } catch { milkinltr = 0; }

                                    totalmilkinltr += milkinltr;
                                    sb.Append(Convert.ToDecimal(milkinltr).ToString("0.0"));
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { clr = Convert.ToDouble(row["CLRReading"]); } catch { clr = 0; }

                                    totalclr += clr;
                                    sb.Append(Convert.ToDecimal(clr).ToString("0.0"));
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { fatinper = Convert.ToDouble(row["FATPercentage"]); } catch { fatinper = 0.00; }

                                    totalfatinper += fatinper;
                                    sb.Append(Convert.ToDecimal(fatinper).ToString("0.0"));
                                    sb.Append("</td>");
                                    sb.Append("<td style='text-align:right'>");
                                    try { snf = Convert.ToDouble(row["SNFPercentage"]); } catch { snf = 0.00; }

                                    totalsnf += snf;
                                    sb.Append(Convert.ToDecimal(snf).ToString("0.0"));
                                    sb.Append("</td>");
                                    sb.Append("<td style='text-align:right'>");
                                    try { ts = Convert.ToDouble(row["TSPercentage"]); } catch { ts = 0.00; }

                                    totalts += ts;
                                    sb.Append(Convert.ToDecimal(ts).ToString("0.0"));
                                    sb.Append("</td>");
                                    sb.Append("<td style='text-align:right'>");
                                    try { rpl = Convert.ToDouble(row["RPL"]); } catch { rpl = 0.00; }

                                    totalrpl += rpl;
                                    sb.Append(Convert.ToDecimal(rpl).ToString("0.00"));
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { inc = Convert.ToDouble(row["QtyIncentive"]); } catch { inc = 0.00; }
                                    try { inc1 = Convert.ToDouble(row["Incentive"]); } catch { inc1 = 0.00; }
                                    //try { inct = }
                                    Incentive = inc + inc1;
                                    totalinc += Incentive;
                                    sb.Append(Convert.ToDecimal(Incentive).ToString("0.00"));
                                    sb.Append("</td>");

                                    sb.Append("<td style='text-align:right'>");
                                    try { amt = Convert.ToDouble(row["Amount"]); } catch { amt = 0.00; }
                                    Amount = amt;
                                    //rpl + Incentive * Convert.ToDouble(milkinltr);
                                    totalamt += Amount;
                                    sb.Append(Convert.ToDecimal(Amount).ToString("0.00"));
                                    sb.Append("</td>");
                                    sb.Append("</tr>");
                                }
                            }
                        }
                    }
                    sb.Append("<tr style='border-bottom:1px solid'><td colspan='13'></td></tr>");
                    sb.Append("<tr style='border-bottom:1px solid'>");
                    sb.Append("<td colspan='4'>");
                    sb.Append("Average :");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");



                    sb.Append("<b>" + Convert.ToDecimal(totalfatinper / count).ToString("0.0") + "</b>");

                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");

                    sb.Append("<b>" + Convert.ToDecimal(totalsnf / count).ToString("0.00") + "</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");

                    sb.Append("<b>" + Convert.ToDecimal(totalts / count).ToString("0.0") + "</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");

                    sb.Append("<b>" + Convert.ToDecimal(totalrpl / count).ToString("0.00") + "</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:left'>");
                    sb.Append("/Ltr.");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:left'>");
                    sb.Append("");
                    sb.Append("</td>");
                    sb.Append("</tr>");
                    sb.Append("<tr style='border-bottom:1px solid'>");
                    sb.Append("<td >");
                    sb.Append("<b>Total :</b>");
                    sb.Append("</td>");
                    sb.Append("<td colspan='2'>");
                    sb.Append("<b>" + count + "</b>");
                    sb.Append("</td>");
                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>" + totalcan);
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right'>");
                    sb.Append("<b>" + Convert.ToDecimal(totalmilkinkg).ToString("0.0") + "</b>");
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right' >");
                    sb.Append("<b>" + Convert.ToDecimal(totalmilkinltr).ToString("0.0") + "</b>");
                    sb.Append("</td>");

                    sb.Append("<td style='text-align:right' colspan='7'>");
                    sb.Append("<b>" + Convert.ToDecimal(totalamt).ToString("0.00") + "</b>");
                    sb.Append("</td>");
                    sb.Append("</tr>");

                    totcount   += count;
                    totcan     += totalcan;
                    totmillkg  += totalmilkinkg;
                    totmilkltr += totalmilkinltr;
                    totamt     += totalamt;
                    totrpl     += totalrpl;
                }

                sb.Append("<tr style='border-bottom:1px solid'> <td colspan = '9'> &nbsp; </td> </tr>");

                sb.Append("<tr style='border-bottom:1px solid'>");
                sb.Append("<td>");
                sb.Append("<b>Count</b>");
                sb.Append("</td>");
                sb.Append("<td colspan='2'>");
                sb.Append("<b>" + totcount + "</b>");
                sb.Append("</td>");

                sb.Append("<td style='text-align:right'>");
                sb.Append("<b>" + totcan + "</b>");
                sb.Append("</td>");
                sb.Append("<td style='text-align:right'>");
                sb.Append("<b>" + totmillkg + "</b>");
                sb.Append("</td>");
                sb.Append("<td style='text-align:right'>");
                sb.Append("<b>" + totmilkltr + "</b>");
                sb.Append("</td>");

                sb.Append("<td colspan='7' style='text-align:right'>");
                sb.Append("<b>" + Convert.ToDecimal(totamt).ToString("00.00") + "</b>");
                sb.Append("</td>");


                sb.Append("</tr>");

                result    = sb.ToString();
                Bill.Text = result;

                Session["ctrl"] = pnlBill;
            }
            else
            {
                result    = "No Records Found";
                Bill.Text = result;
            }
        }
Пример #13
0
        protected void btnAddMilk_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            if (rdRecieving.Checked)
            {
                p.flag1 = "Receiving";
                p.ID    = Convert.ToInt32(dpParticularreceive.SelectedItem.Value);
            }
            else
            {
                p.flag1 = "Disposal";
                p.ID    = Convert.ToInt32(dpParticulardispose.SelectedItem.Value);
            }
            p.BatchWiseMilkCollectionID = 0;
            p.BatchWiseMilkDisposalID   = 0;
            p.BatchNo         = txtBatch.Text;
            p.VehicleNo       = txtVehicalNo.Text;
            p.Session         = txtTime.Text;
            p.Date            = Convert.ToDateTime(txtDate.Text);
            p.MilkInKG        = Convert.ToDecimal(txtMilkInKG.Text);
            p.ActualMilkInLtr = Convert.ToDecimal(txtMilkInLtr.Text);
            p.MilkType        = dpMilkType.SelectedItem.Text;
            p.CenterID        = 6; //GlobalInfo.Userid;
            p.Temp            = Convert.ToDecimal(txtTEmp.Text);
            p.Acidity         = Convert.ToDecimal(txtAcidity.Text);
            p.FATPercentage   = Convert.ToDecimal(txtFATPercentage.Text);
            p.SNFPercentage   = Convert.ToDecimal(txtSNFPercentage.Text);
            p.Time            = txtTime.Text;
            //  p.HandlingExcess =!string.IsNullOrEmpty(txtHandlingExcess.Text)?Convert.ToDecimal(txtHandlingExcess.Text):0;
            // p.HandlingLoss = !string.IsNullOrEmpty(txtHandlingLoss.Text)?Convert.ToDecimal(txtHandlingLoss.Text):0;
            //   p.Disposal = dpdestination.SelectedItem.Text;
            // p.InternameConsumption =!string.IsNullOrEmpty(txtInternalConsumption.Text)? Convert.ToDecimal(txtInternalConsumption.Text):0;
            //  p.DamageMilk =!string.IsNullOrEmpty(txtDamageMilk.Text)? Convert.ToDecimal(txtDamageMilk.Text):0;
            //  p.Other =!string.IsNullOrEmpty(TextBtxtOther.Text)? Convert.ToDecimal(TextBtxtOther.Text):0;
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");

            p.flag = "Insert";

            DS = pd.GetOpeningClosingBal(p.Date, p.CenterID);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                p.BalanceID = Convert.ToInt32(string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BalanceID"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BalanceID"].ToString());
                decimal OpeningBal = Convert.ToDecimal(string.IsNullOrEmpty(DS.Tables[0].Rows[0]["OpeningBalance"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["OpeningBalance"].ToString());
                decimal ClosingBal = Convert.ToDecimal(string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ClosingBalance"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ClosingBalance"].ToString());
                if (rdRecieving.Checked)
                {
                    p.ClosingBalance = ClosingBal + p.ActualMilkInLtr;
                }
                else
                {
                    p.ClosingBalance = ClosingBal - p.ActualMilkInLtr;
                }
                p.flag2 = "Update";
            }
            else
            {
                DateTime PrevDate = p.Date.AddDays(-1);
                DS = pd.GetOpeningClosingBal(PrevDate, p.CenterID);
                if (!Comman.Comman.IsDataSetEmpty(DS))
                {
                    if (rdRecieving.Checked)
                    {
                        p.OpeningBalance = Convert.ToDecimal(string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ClosingBalance"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ClosingBalance"].ToString());
                        p.ClosingBalance = p.OpeningBalance + p.ActualMilkInLtr;
                    }
                    else
                    {
                        p.OpeningBalance = Convert.ToDecimal(string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ClosingBalance"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ClosingBalance"].ToString());
                        p.ClosingBalance = p.OpeningBalance - p.ActualMilkInLtr;
                    }
                }
                else
                {
                    p.OpeningBalance = 0;
                    p.ClosingBalance = p.ActualMilkInLtr;
                }
                p.BalanceID = 0;
                p.flag2     = "insert";
            }
            int Result = 0;

            Result = pd.InsertBatchWiseMilkCollection(p);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Milk Collection Record Add  Successfully";

                ClearTextBox();
                //BindMilkCollectionList();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #14
0
        protected void btnupdateMilk_Click(object sender, EventArgs e)
        {
            Model.Procurement p  = new Model.Procurement();
            ProcurementData   pd = new ProcurementData();

            if (rdRecieving.Checked)
            {
                p.BatchWiseMilkCollectionID = string.IsNullOrEmpty(hfBatchWiseMilkCollectionID.Value) ? 0 : Convert.ToInt32(hfBatchWiseMilkCollectionID.Value);
                p.BatchWiseMilkDisposalID   = 0;
                p.flag1 = "Receiving";
                p.ID    = Convert.ToInt32(dpParticularreceive.SelectedItem.Value);
            }
            else
            {
                p.BatchWiseMilkDisposalID   = string.IsNullOrEmpty(hfBatchWiseMilkCollectionID.Value) ? 0 : Convert.ToInt32(hfBatchWiseMilkCollectionID.Value);
                p.BatchWiseMilkCollectionID = 0;
                p.flag1 = "Disposal";
                p.ID    = Convert.ToInt32(dpParticulardispose.SelectedItem.Value);
            }

            p.BatchNo         = txtBatch.Text;
            p.VehicleNo       = txtVehicalNo.Text;
            p.Session         = txtTime.Text;
            p.Date            = Convert.ToDateTime(txtDate.Text);
            p.MilkInKG        = Convert.ToDecimal(txtMilkInKG.Text);
            p.ActualMilkInLtr = Convert.ToDecimal(txtMilkInLtr.Text);
            p.MilkType        = dpMilkType.SelectedItem.Text;
            p.CenterID        = 6;//App_code.GlobalInfo.Userid;
            p.Temp            = Convert.ToDecimal(txtTEmp.Text);
            p.Acidity         = Convert.ToDecimal(txtAcidity.Text);
            p.FATPercentage   = Convert.ToDecimal(txtFATPercentage.Text);
            p.SNFPercentage   = Convert.ToDecimal(txtSNFPercentage.Text);
            p.Time            = txtTime.Text;
            // p.Disposal = dpdestination.SelectedItem.Text;
            // p.HandlingExcess = Convert.ToDecimal(txtHandlingExcess.Text);
            // p.HandlingLoss = Convert.ToDecimal(txtHandlingLoss.Text);
            // p.InternameConsumption = Convert.ToDecimal(txtInternalConsumption.Text);
            // p.DamageMilk = Convert.ToDecimal(txtDamageMilk.Text);
            //p.Other = Convert.ToDecimal(TextBtxtOther.Text);
            p.CreatedBy    = App_code.GlobalInfo.Userid;
            p.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            p.ModifiedBy   = App_code.GlobalInfo.Userid;
            p.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            p.flag         = "Update";
            p.flag2        = "";
            int Result = 0;

            Result = pd.InsertBatchWiseMilkCollection(p);
            if (Result > 0)
            {
                //lbltital.Text = "Add Route";
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Milk Collection Record Updated  Successfully";
                ClearTextBox();
                //BindMilkCollectionList();
                pnlError.Update();
                btnAddMilk.Visible    = true;
                btnupdateMilk.Visible = false;
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Пример #15
0
        //protected void txtMilkInKG_TextChanged(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        double milkInLtr = System.Math.Round((Convert.ToDouble(txtMilkInKG.Text) / 1.03), 2);
        //        txtMilkInLtr.Text = milkInLtr.ToString();
        //        string num = milkInLtr.ToString("0.0");
        //        string outnum = BreakUpSingleDecimalPlace(num);
        //        txtActualMilkInLtr.Text = outnum;
        //        // txtActualMilkInLtr.Text = System.Math.Round(milkInLtr, 1,
        //        //MidpointRounding.ToEven).ToString(); // Rounds to even

        //        ((TextBox)sender).Focus();
        //        ScriptManager manager = ScriptManager.GetCurrent(this);
        //        manager.SetFocus(txtCLRReading);

        //    }
        //    catch (Exception)
        //    {
        //        ((TextBox)sender).Focus();
        //        ScriptManager manager = ScriptManager.GetCurrent(this);
        //        manager.SetFocus(txtCLRReading);
        //    }
        //}



        //public string BreakUpSingleDecimalPlace(string num)
        //{
        //    string s = num;
        //    string[] parts = s.Split('.');
        //    int i1 = int.Parse(parts[0]);
        //    int i2 = int.Parse(parts[1]);
        //    string shortnum = i2.ToString();
        //    if (shortnum.Length > 1)
        //    {
        //        num = num.Remove(num.Length - 1, 1);
        //    }
        //    return num;

        //}

        //protected void txtCLRReading_TextChanged(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (txtFATPercentage.Text != string.Empty)
        //        {
        //            txtFATInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtFATPercentage.Text)) / 100), 2).ToString();
        //            string snfpercentage = System.Math.Round((Convert.ToDouble(txtCLRReading.Text) / 4 + (0.2 * Convert.ToDouble(txtFATPercentage.Text)) + 0.36), 2).ToString();
        //            string outsnfpercentage = BreakUpSingleDecimalPlace(snfpercentage);
        //            txtSNFPercentage.Text = outsnfpercentage;
        //            txtSNFInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtSNFPercentage.Text)) / 100), 2).ToString();
        //            string tsPercent = System.Math.Round((Convert.ToDouble(txtFATPercentage.Text) + Convert.ToDouble(txtSNFPercentage.Text)), 2).ToString();
        //            string outtspercent = BreakUpSingleDecimalPlace(tsPercent);
        //            txtTSPercentage.Text = outtspercent;
        //            txtTSKG.Text = System.Math.Round((Convert.ToDouble(txtFATInKG.Text) + Convert.ToDouble(txtSNFInKG.Text)), 2).ToString();



        //        }
        //        else if (txtFATPercentage.Text == string.Empty)
        //        {
        //            //txtFATPercentage.Text = Convert.ToDouble(0).ToString();
        //            ((TextBox)sender).Focus();
        //            ScriptManager managers1 = ScriptManager.GetCurrent(this);
        //            managers1.SetFocus(txtFATPercentage);
        //        }


        //    }
        //    catch (Exception ex)
        //    {
        //        string msg = ex.Message.ToString();

        //        ScriptManager managers2 = ScriptManager.GetCurrent(this);
        //        managers2.SetFocus(txtFATPercentage);
        //    }



        //}

        //protected void txtFATPercentage_TextChanged(object sender, EventArgs e)
        //{
        //    try
        //    {

        //        txtFATInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtFATPercentage.Text)) / 100), 2).ToString();

        //        string snfpercentage = System.Math.Round((Convert.ToDouble(txtCLRReading.Text) / 4 + (0.2 * Convert.ToDouble(txtFATPercentage.Text)) + 0.36), 2).ToString();
        //        string outsnfpercentage = BreakUpSingleDecimalPlace(snfpercentage);
        //        txtSNFPercentage.Text = outsnfpercentage;
        //        txtSNFInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtSNFPercentage.Text)) / 100), 2).ToString();
        //        string tsPercent = System.Math.Round((Convert.ToDouble(txtFATPercentage.Text) + Convert.ToDouble(txtSNFPercentage.Text)), 2).ToString();
        //        string outtspercent = BreakUpSingleDecimalPlace(tsPercent);
        //        txtTSPercentage.Text = outtspercent;

        //        txtTSKG.Text = System.Math.Round((Convert.ToDouble(txtFATInKG.Text) + Convert.ToDouble(txtSNFInKG.Text)), 2).ToString();
        //        //((Button)sender).Focus();
        //        //ScriptManager managers3 = ScriptManager.GetCurrent(this);
        //        //managers3.SetFocus(btnAddMilkCollection);
        //    }
        //    catch (Exception ex)
        //    {
        //        string msg = ex.Message.ToString();



        //    }
        //}

        //protected void calculate()
        //{
        //    try
        //    {
        //        if (txtFATPercentage.Text != "")
        //        {
        //            txtFATInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtFATPercentage.Text)) / 100), 2).ToString();
        //        }
        //        else {
        //            txtFATPercentage.Text = Convert.ToDouble(0).ToString();
        //        }
        //        string snfpercentage = System.Math.Round((Convert.ToDouble(txtCLRReading.Text) / 4 + (0.2 * Convert.ToDouble(txtFATPercentage.Text)) + 0.36), 2).ToString();
        //        string outsnfpercentage = BreakUpSingleDecimalPlace(snfpercentage);
        //        txtSNFPercentage.Text = outsnfpercentage;
        //        txtSNFInKG.Text = System.Math.Round(((Convert.ToDouble(txtMilkInKG.Text) * Convert.ToDouble(txtSNFPercentage.Text)) / 100), 2).ToString();
        //        string tsPercent = System.Math.Round((Convert.ToDouble(txtFATPercentage.Text) + Convert.ToDouble(txtSNFPercentage.Text)), 2).ToString();
        //        string outtspercent = BreakUpSingleDecimalPlace(tsPercent);
        //        txtTSPercentage.Text = outtspercent;

        //        txtTSKG.Text = System.Math.Round((Convert.ToDouble(txtFATInKG.Text) + Convert.ToDouble(txtSNFInKG.Text)), 2).ToString();
        //        //

        //    }
        //    catch (Exception ex)
        //    {
        //        string msg = ex.Message.ToString();

        //        txtFATPercentage.Focus();

        //    }

        //}

        protected void btnAddMilkCollection_Click(object sender, EventArgs e)
        {
            try
            {
                Model.Procurement p1  = new Model.Procurement();
                ProcurementData   pd1 = new ProcurementData();
                p1.Date       = Convert.ToDateTime(txtDate.Text.ToString());
                p1.Session    = dpSession.SelectedItem.Text;
                p1.SupplierID = Convert.ToInt32(dpSupplier.SelectedItem.Value);
                DS            = pd1.GetExistingData(p1);
                if (!Comman.Comman.IsDataSetEmpty(DS))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Supplier Already exist for the same date and session.')", true);
                    ClearTextBox();
                    txtMilkCan.Focus();
                    //dpSupplier.Focus();
                    int selectnextvalue = dpSupplier.Items.IndexOf(dpSupplier.Items.FindByValue(dpSupplier.SelectedItem.Value));
                    try
                    {
                        dpSupplier.SelectedIndex = selectnextvalue + 1;
                    }
                    catch { }
                }
                else
                {
                    txtActualMilkInLtr.ReadOnly = false;
                    txtMilkInLtr.ReadOnly       = false;
                    txtSNFPercentage.ReadOnly   = false;
                    txtTSPercentage.ReadOnly    = false;
                    txtFATInKG.ReadOnly         = false;
                    txtSNFInKG.ReadOnly         = false;
                    txtTSKG.ReadOnly            = false;
                    Model.Procurement p  = new Model.Procurement();
                    ProcurementData   pd = new ProcurementData();
                    p.MilkCollectionID = 0;
                    p.Batch            = txtBatch.Text;
                    p.Session          = dpSession.SelectedItem.Text;

                    p.Date            = Convert.ToDateTime(txtDate.Text.ToString());
                    p.MilkInKG        = Convert.ToDecimal(txtMilkInKG.Text);
                    p.MilkInLtr       = Convert.ToDecimal(txtMilkInLtr.Text);
                    p.ActualMilkInLtr = Convert.ToDecimal(txtActualMilkInLtr.Text);
                    p.RouteID         = Convert.ToInt32(dpRoute.SelectedItem.Value);
                    p.SupplierID      = Convert.ToInt32(dpSupplier.SelectedItem.Value);
                    p.FATPercentage   = Convert.ToDecimal(txtFATPercentage.Text);
                    p.FATInKG         = Convert.ToDecimal(txtFATInKG.Text);
                    p.CLRReading      = Convert.ToDecimal(txtCLRReading.Text);
                    //p.SNF = Convert.ToDecimal(txtSNF.Text);
                    p.SNFPercentage = Convert.ToDecimal(txtSNFPercentage.Text);
                    p.SNFInKG       = Convert.ToDecimal(txtSNFInKG.Text);
                    p.TSPercentage  = Convert.ToDecimal(txtTSPercentage.Text);
                    p.TSInKg        = Convert.ToDecimal(txtTSKG.Text);
                    p.MilkCan       = Convert.ToInt32(txtMilkCan.Text);
                    p.CreatedBy     = App_code.GlobalInfo.Userid;
                    p.Createddate   = DateTime.Now.ToString("dd-MM-yyyy");
                    p.ModifiedBy    = App_code.GlobalInfo.Userid;
                    p.ModifiedDate  = DateTime.Now.ToString("dd-MM-yyyy");
                    p.flag          = "Insert";
                    int Result = 0;
                    Result = pd.InsertMilkCollectionDetails(p);
                    if (Result > 0)
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = false;
                        divSusccess.Visible = true;
                        lblSuccess.Text     = "Milk Collection Record Add  Successfully";

                        ClearTextBox();
                        //BindMilkCollectionList();
                        pnlError.Update();
                        upMain.Update();
                        uprouteList.Update();
                        txtMilkCan.Focus();

                        int selectnextvalue = dpSupplier.Items.IndexOf(dpSupplier.Items.FindByValue(dpSupplier.SelectedItem.Value));
                        try
                        {
                            dpSupplier.SelectedIndex = selectnextvalue + 1;
                            divwarning.Visible       = false;
                            divSusccess.Visible      = false;
                            pnlError.Update();
                            upMain.Update();
                            //Page.ClientScript.RegisterStartupScript(this.GetType(), "somekey", "autoHide();", false);
                        }
                        catch { }
                    }
                    else
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = true;
                        divSusccess.Visible = false;
                        lblwarning.Text     = "Please Contact to Site Admin";
                        pnlError.Update();
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message.ToString();
            }
        }