Exemplo n.º 1
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        if (ViewState["action"].ToString() == "Alter")
        {
            txtcheckindate.Text = objcls.yearmonthdate(txtcheckindate.Text);
            txtcheckout.Text    = objcls.yearmonthdate(txtcheckout.Text);
            chkinsave           = DateTime.Parse(txtcheckindate.Text + " " + txtcheckintime.Text);
            chkoutsave          = DateTime.Parse(txtcheckout.Text + " " + txtcheckouttime.Text);
            string chkinsave1  = chkinsave.ToString("yyyy-MM-dd HH:mm:ss");
            string chkoutsave1 = chkoutsave.ToString("yyyy-MM-dd HH:mm:ss");

            OdbcTransaction trans = null;
            OdbcConnection  con   = objcls.NewConnection();
            try
            {
                trans = con.BeginTransaction();

                string      up  = @"update t_roomreservation set reservedate='" + chkinsave1 + "' , expvacdate='" + chkoutsave1 + "',room_id=" + cmbRooms.SelectedValue + " where reserve_no='" + txtReserveNo.Text + "'";
                OdbcCommand cmd = new OdbcCommand(up, con);
                cmd.Transaction = trans;
                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    //string up1 = @"update t_roomreservation_generaltdbtemp set reservedate='" + chkinsave1 + "', expvacdate='" + chkoutsave1 + "',room_rent="+decimal.Parse(txtroomrent.Text)+",security_deposit="+decimal.Parse(txtsecuritydeposit.Text)+",other_charge="+decimal.Parse(txtothercharge.Text)+",advance="+decimal.Parse(txtadvance.Text)+",total_charge="+decimal.Parse(txttotalamount.Text)+",balance_amount="+decimal.Parse(txtnetpayable.Text)+" where reserve_no='" + txtReserveNo.Text + "'";
                    string      up1  = @"update t_roomreservation_generaltdbtemp set reservedate='" + chkinsave1 + "', expvacdate='" + chkoutsave1 + "',total_days=" + txthours.Text + ",room_rent=" + txtroomrent.Text + ",security_deposit=" + txtsecuritydeposit.Text + ",other_charge=" + txtothercharge.Text + ",advance=" + txtadvance.Text + ",total_charge=" + txttotalamount.Text + ",balance_amount=" + txtnetpayable.Text + " where reserve_no='" + txtReserveNo.Text + "'";
                    OdbcCommand cmd1 = new OdbcCommand(up1, con);
                    cmd1.Transaction = trans;
                    int i1 = cmd1.ExecuteNonQuery();

                    string      format = @"select DATE_FORMAT(STR_TO_DATE('" + Session["chkin"].ToString() + "','%d/%m/%Y %l:%i %p'),'%Y-%m-%d %T'),DATE_FORMAT(STR_TO_DATE('" + Session["chkout"].ToString() + "','%d/%m/%Y %l:%i %p'),'%Y-%m-%d %T')";
                    OdbcCommand cmd2   = new OdbcCommand(format, con);
                    cmd2.Transaction = trans;
                    OdbcDataAdapter da     = new OdbcDataAdapter(cmd2);
                    DataTable       dt_for = new DataTable();
                    da.Fill(dt_for);


                    string      insert = @"INSERT INTO t_reservealteration(reserve_no,pre_chkin,pre_chkout,alt_date) VALUES('" + txtReserveNo.Text + "','" + dt_for.Rows[0][0].ToString() + "','" + dt_for.Rows[0][1].ToString() + "',now())";
                    OdbcCommand cmd3   = new OdbcCommand(insert, con);
                    cmd3.Transaction = trans;
                    int i2 = cmd3.ExecuteNonQuery();
                    if ((i1 * i2) == 1)
                    {
                        trans.Commit();
                        con.Close();
                        ViewState["action"] = "NILL";
                        clear();
                        okmessage("Tsunami ARMS - Warning", "Reservation altered");
                        this.ScriptManager1.SetFocus(btnOk);
                        return;
                    }
                }
            }
            catch
            {
                trans.Rollback();
                con.Close();
            }
        }
    }
Exemplo n.º 2
0
    private void view()
    {
        string      str1  = objcls.yearmonthdate(txtreportdatefrom.Text);
        string      str2  = objcls.yearmonthdate(txtreportdateto.Text);
        OdbcCommand cmd31 = new OdbcCommand();

        cmd31.Parameters.AddWithValue("tblname", " t_roomreservation,t_roomallocation,m_room,m_sub_building ");
        cmd31.Parameters.AddWithValue("attribute", "t_roomreservation.room_id,t_roomreservation.reserve_no,t_roomreservation.place,t_roomreservation.reservedate 'Reserve from',t_roomreservation.expvacdate 'Reserve To',m_sub_building.buildingname 'Building',m_room.roomno 'Room No',case reserve_mode when 'tdb' then 'TDB Res' when 'Donor Free' then 'Donor free' when 'Donor Paid' then 'Donor paid' when 'General' then 'General' END as 'Customer Type',t_roomreservation.swaminame,t_roomallocation.mobile");
        if (cmbReportpass.SelectedValue == "-1")
        {
            //cmd31.Parameters.AddWithValue("conditionv", " status_reserve='0' and t_roomreservation.reserve_no=t_roomallocation.reserve_id and t_roomallocation.roomstatus!=2 and t_roomreservation.room_id=m_room.room_id and m_room.build_id=m_sub_building.build_id and date(reservedate) >= '" + str1.ToString() + "' and date(reservedate) <  '" + str2.ToString() + "' and t_roomreservation.room_id=t_roomreservation.room_id order by t_roomallocation.room_id  asc");
            cmd31.Parameters.AddWithValue("conditionv", " status_reserve='0' and t_roomreservation.reserve_no=t_roomallocation.reserve_id and t_roomreservation.room_id=m_room.room_id and m_room.build_id=m_sub_building.build_id and date(reservedate) >= '" + str1.ToString() + "' and date(reservedate) <  '" + str2.ToString() + "' and t_roomreservation.room_id=t_roomreservation.room_id AND m_room.room_id NOT IN (SELECT t_roomallocation.room_id FROM t_roomallocation WHERE t_roomallocation.allocdate BETWEEN '" + str1.ToString() + "' AND  '" + str2.ToString() + "' AND t_roomallocation.exp_vecatedate BETWEEN '" + str1.ToString() + "' AND '" + str2.ToString() + "' )ORDER BY t_roomreservation.room_id ASC");
        }
        else
        {
            cmd31.Parameters.AddWithValue("conditionv", " status_reserve='0' and t_roomreservation.reserve_no=t_roomallocation.reserve_id and t_roomreservation.room_id=m_room.room_id and m_room.build_id=m_sub_building.build_id and reserve_mode='" + cmbReportpass.SelectedValue + "' and date(reservedate) >= '" + str1.ToString() + "' and date(reservedate) <  '" + str2.ToString() + "' and t_roomreservation.room_id=t_roomreservation.room_id AND m_room.room_id NOT IN (SELECT t_roomallocation.room_id FROM t_roomallocation WHERE t_roomallocation.allocdate BETWEEN '" + str1.ToString() + "' AND  '" + str2.ToString() + "' AND t_roomallocation.exp_vecatedate BETWEEN '" + str1.ToString() + "' AND '" + str2.ToString() + "' )ORDER BY t_roomreservation.room_id ASC");
        }
        DataTable dtrr = new DataTable();

        dtrr = objcls.SpDtTbl("call selectcond(?,?,?)", cmd31);
        dt   = dtrr;

        if (dt.Rows.Count > 0)
        {
            gv_details.DataSource = dt;
            gv_details.DataBind();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowNoData();", true);
        }
    }
Exemplo n.º 3
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtdate.Text != "" || txtinmates.Text != "" || txtaddinmates.Text != "" || cmbtype.SelectedValue != "" || cmbcategory.SelectedValue != "")
     {
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("inmates_id", "t_policy_numberofinmates");
         pk = pk + 1;
         //double amount = Convert.ToDouble(txtamount.Text);
         //double inmates=Convert.ToDouble(txtinmates.Text);
         //double maxinmates=Convert.ToDouble(txtaddinmates.Text);
         //string totalamount = @"SELECT rent FROM m_rent WHERE id=(select max(id) from m_rent where room_category=" + cmbcategory.SelectedValue + ")";
         //DataTable dt_totalamount = objcls.DtTbl(totalamount);
         //if (dt_totalamount.Rows[0][0].ToString() != "")
         //{
         //    amountdt = Convert.ToDouble(dt_totalamount.Rows[0][0].ToString());
         //    fi_amount = (inmates + maxinmates) / maxinmates * amountdt;
         //}
         string gh = @"insert into t_policy_numberofinmates(inmates_id,room_category,num_of_inmates,max_num_of_add_inmates,policy_type,fromdate,todate,createdby,createdon,updatedby,updatedon,rowstatus)values('" + pk + "','" + cmbcategory.SelectedValue + "','" + txtinmates.Text + "','" + txtaddinmates.Text + "','" + cmbtype.SelectedValue + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30','" + userid + "',curdate(),'" + userid + "',curdate(),0)";
         objcls.exeNonQuery(gh);
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         int pknew;
         pknew = pk - 1;
         objcls.exeNonQuery("update t_policy_numberofinmates set todate='" + objcls.yearmonthdate(txtdate.Text) + "' where inmates_id=" + pknew);
         gridbind();
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
 }
Exemplo n.º 4
0
    protected void btnCorrect_Click(object sender, EventArgs e)
    {
        if ((cmbCounter.SelectedValue != "-1") && (cmbStatus.SelectedValue != "-1") && (txtReceiptno.Text != ""))
        {
            string q_dayend = "SELECT DISTINCT DATE_FORMAT(dayend,'%d-%m-%Y') FROM t_roomallocation WHERE adv_recieptno=" + txtReceiptno.Text + " AND counter_id=" + cmbCounter.SelectedValue + "";
            string dayend   = objcls.exeScalar(q_dayend);
            if (dayend != "")
            {
                string dayendnew     = objcls.yearmonthdate(dayend);
                string q_dayendcheck = "SELECT DATE_FORMAT(closedate_start,'%d-%m-%Y') AS closedate_start FROM  t_dayclosing WHERE daystatus='open' AND DATE_FORMAT(closedate_start,'%d-%m-%Y')='" + dayend + "'";
                string dayendcheck   = objcls.exeScalar(q_dayendcheck);
                if (dayendcheck != "")
                {
                    int correctid = objcls.PK_exeSaclarInt("crct_id", "t_receiptcorrection");
                    correctid = correctid + 1;
                    OdbcTransaction odbTrans = null;
                    try
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.ConnectionString = strConnection;
                            con.Open();
                        }
                        odbTrans = con.BeginTransaction();
                        int         receiptno       = Convert.ToInt32(txtReceiptno.Text) + 1;
                        string      q_receiptstatus = @"INSERT INTO t_receiptcorrection(crct_id,counter_no,recipt_no,crct_status,crct_date,dayend)
VALUES (" + correctid + "," + cmbCounter.SelectedValue + "," + txtReceiptno.Text + "," + cmbStatus.SelectedValue + ",now(),'" + dayendnew + "')";
                        OdbcCommand cmd1            = new OdbcCommand(q_receiptstatus, con);
                        cmd1.Transaction = odbTrans;
                        cmd1.ExecuteNonQuery();
                        string      q_correct = @"UPDATE t_roomallocation SET adv_recieptno=adv_recieptno+1 WHERE adv_recieptno>=" + txtReceiptno.Text + " AND counter_id=" + cmbCounter.SelectedValue + "";
                        OdbcCommand cmd2      = new OdbcCommand(q_correct, con);
                        cmd2.Transaction = odbTrans;
                        cmd2.ExecuteNonQuery();
                        odbTrans.Commit();
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowUpdated();", true);
                        clear();
                    }
                    catch
                    {
                        odbTrans.Rollback();
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowError();", true);
                        clear();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showdate();", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
            }
        }
    }
Exemplo n.º 5
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtdate.Text == "" || txtrate.Text == "" || cmbdamage.SelectedValue == "" || cmbroom.SelectedValue == "")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
     else
     {
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("id", "p_room_damage");
         pk = pk + 1;
         string    fh        = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate";
         DataTable dt_select = objcls.DtTbl(fh);
         string    dh        = @"insert into p_room_damage(id,season_id,policy_applicable_from,to_date,room_category,damages,rate,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30'," + cmbroom.SelectedValue + "," + cmbdamage.SelectedValue + "," + txtrate.Text + ",curdate(),'" + userid + "',0)";
         objcls.exeNonQuery(dh);
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         int pknew;
         pknew = pk - 1;
         objcls.exeNonQuery("update p_room_damage set to_date='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew);
         gridbind();
     }
 }
Exemplo n.º 6
0
    protected void btnremit_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtremitamount.Text != "" && txtdate.Text != "")
            {
                string insert = @"INSERT INTO `armsapr9`.`t_unclaimedremittance`
            (
             `Date`,
             `season_id`,
             `amount`)
VALUES (
        '" + objcls.yearmonthdate(txtdate.Text) + "','" + Session["seasonid"].ToString() + "',  '" + txtremitamount.Text + "');";
                objcls.exeNonQuery(insert);
                txtremitamount.Text = "";
                clr();
                obc.ShowAlertMessage(this, "Saved successfully");
            }
        }
        catch
        {
        }
    }
Exemplo n.º 7
0
    protected void cmbReserve_SelectedIndexChanged(object sender, EventArgs e)
    {
        string createddate = objcls.yearmonthdate(cmbReserve.SelectedItem.Text);
        string da          = createddate.Replace('/', '-');

        string    selecttype    = "SELECT id,TYPE FROM p_type_of_user where status=0";
        DataTable dtselect_type = objcls.DtTbl(selecttype);

        //DataRow rowtype = dtselect_type.NewRow();
        //rowtype["id"] = "-1";
        //rowtype["TYPE"] = "--Select--";
        //dtselect_type.Rows.InsertAt(rowtype, 0);
        ddltype.DataSource = dtselect_type;
        ddltype.DataBind();
        string    type = "General";
        string    reservetypeselect   = "SELECT DISTINCT room_category_id FROM t_roomreservation_generaltdbtemp WHERE reserve_mode='" + type + "' AND DATE_FORMAT(reservedate,'%Y-%m-%d')='" + da + "'";
        DataTable dtreservetypeselect = objcls.DtTbl(reservetypeselect);

        if (dtreservetypeselect.Rows.Count > 0)
        {
            OdbcCommand cmdroomcategory = new OdbcCommand();
            cmdroomcategory.Parameters.AddWithValue("tblname", "m_sub_room_category,p_roomstatus,t_roomreservation_generaltdbtemp");
            cmdroomcategory.Parameters.AddWithValue("attribute", "DISTINCT room_cat_name,room_cat_id");
            cmdroomcategory.Parameters.AddWithValue("conditionv", "p_roomstatus.room_category_id=m_sub_room_category.room_cat_id and rowstatus<>" + 2 + " AND t_roomreservation_generaltdbtemp.reserve_mode='" + type + "' AND DATE_FORMAT(reservedate,'%Y-%m-%d')='" + da + "' AND t_roomreservation_generaltdbtemp.room_category_id=m_sub_room_category.room_cat_id ORDER BY p_roomstatus.room_category_id asc");
            DataTable dtroomcategory = new DataTable();
            dtroomcategory = objcls.SpDtTbl("Call selectcond(?,?,?)", cmdroomcategory);
            DataRow rowroomcat = dtroomcategory.NewRow();
            rowroomcat["room_cat_id"]   = "-1";
            rowroomcat["room_cat_name"] = "--Select--";
            dtroomcategory.Rows.InsertAt(rowroomcat, 0);
            ddlcat.DataSource = dtroomcategory;
            ddlcat.DataBind();
        }
        else
        {
        }
    }
Exemplo n.º 8
0
 protected void txtPolicyperiodFrom_TextChanged(object sender, EventArgs e)
 {
     #region FROMDATE GREATER THAN 1970
     string   dtss = obje.yearmonthdate(txtPolicyperiodFrom.Text.ToString());
     DateTime dts1 = DateTime.Parse(dtss);
     string   yea  = dts1.ToString("yyyy");
     int      yyo  = int.Parse(yea);
     if (yyo < 1970)
     {
         txtPolicyperiodFrom.Text = "";
         lblOk.Text       = " From date should greater than 1970 "; lblHead.Text = "Tsunami ARMS - Warning";
         pnlOk.Visible    = true;
         pnlYesNo.Visible = false;
         ModalPopupExtender2.Show();
         this.ScriptManager1.SetFocus(txtPolicyperiodTo);
     }
     #endregion
 }
Exemplo n.º 9
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtdate.Text == "" || cmbtype.SelectedValue == "")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
     else
     {
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("id", "p_clubbing");
         pk = pk + 1;
         string    fh        = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate";
         DataTable dt_select = objcls.DtTbl(fh);
         string    dh        = @"insert into p_clubbing(id,season_id,from_date,to_date,reserve_types,clubbing_status,created_on,created_by,updated_on,updated_by,row_status)values(" + pk + "," + dt_select.Rows[0][0].ToString() + ",'" + objcls.yearmonthdate(txtdate.Text) + "','" + objcls.yearmonthdate(txttodate.Text) + "'," + cmbtype.SelectedValue + ",'" + cmbclubbing.SelectedValue + "',curdate(),'" + userid + "', curdate(),'" + userid + "',0)";
         objcls.exeNonQuery(dh);
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         gridbind();
     }
 }
Exemplo n.º 10
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtcancel.Text == "" || txtdate.Text == "" || ddlcheck.SelectedValue == "" || ddlpayment.SelectedValue == "" || ddltype.SelectedValue == "")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
     else
     {
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("id", "p_checking");
         pk = pk + 1;
         string    fh        = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtdate.Text) + "' between startdate and enddate";
         DataTable dt_select = objcls.DtTbl(fh);
         string    dh        = @"insert into p_checking(id,season_id,from_date,to_date,reserve_type,proposed_check_in,payment,holding_period,created_on,created_by,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "','" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30'," + ddltype.SelectedValue + "," + ddlcheck.SelectedValue + "," + ddlpayment.SelectedValue + "," + txtcancel.Text + ",curdate(),'" + userid + "',curdate(),'" + userid + "',0)";
         objcls.exeNonQuery(dh);
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         int pknew;
         pknew = pk - 1;
         objcls.exeNonQuery("update p_checking set to_date='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew);
         gridbind();
     }
 }
Exemplo n.º 11
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtfrmdate.Text != "" && txtallocation.Text != "" && cmballocrequest.SelectedValue != "" && txtcriteria.Text != "")
     {
         string date = datenew();
         con = objcls.NewConnection();
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("pastallocation_id", "t_policy_pastallocation");
         pk = pk + 1;
         if (con.State == ConnectionState.Closed)
         {
             con.ConnectionString = strConnection;
             con.Open();
         }
         OdbcCommand cmd = new OdbcCommand("insert into t_policy_pastallocation(pastallocation_id,allocation_request,fromdate,todate,max_roomallocate,checkingid,createdby,createdon,updatedby,updatedon,rowstatus)values(" + pk + ",'" + cmballocrequest.SelectedItem.ToString() + "','" + objcls.yearmonthdate(txtfrmdate.Text) + "','9999-12-30'," + txtallocation.Text + ",'" + txtcriteria.Text + "','" + userid + "','" + date + "','" + userid + "','" + date + "',0)", con);
         int         i   = cmd.ExecuteNonQuery();
         if (i == 1)
         {
             System.Windows.Forms.MessageBox.Show("Saved Successfully");
         }
         int pknew;
         pknew = pk - 1;
         OdbcCommand cmddate = new OdbcCommand("update  t_policy_pastallocation set todate='" + objcls.yearmonthdate(txtfrmdate.Text) + "' where pastallocation_id=" + pknew, con);
         cmddate.ExecuteNonQuery();
         gridbind();
     }
     else
     {
         System.Windows.Forms.MessageBox.Show("Enter the Value");
     }
 }
Exemplo n.º 12
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (txtstartdate.Text == "" || txtstartchkdate.Text == "" || txtmaxreserve.Text == "" || txtendchkdate.Text == "" || txtclosed.Text == "" || cmbtype.SelectedValue == "" || cmbseason.SelectedValue == "" || cmbcancel.SelectedValue == "" || cmbalter.SelectedValue == "")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
     else
     {
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("id", "p_genpublic_seasons");
         pk = pk + 1;
         string    fh        = @"select m_season.season_id from m_season where '" + objcls.yearmonthdate(txtstartchkdate.Text) + "' between startdate and enddate";
         DataTable dt_select = objcls.DtTbl(fh);
         string    dh        = @"insert into p_genpublic_seasons(id,season_id,season_sub_id,r_startdate,in_startdate,in_enddate,alter_status,type_id,max_reserv,day_close,cancel_status,updated_on,updated_by,row_status)values(" + pk + ",'" + dt_select.Rows[0][0].ToString() + "'," + cmbseason.SelectedValue + ",'" + objcls.yearmonthdate(txtstartdate.Text) + "','" + objcls.yearmonthdate(txtstartchkdate.Text) + "','" + objcls.yearmonthdate(txtendchkdate.Text) + "'," + cmbalter.SelectedValue + "," + cmbtype.SelectedValue + "," + txtmaxreserve.Text + "," + txtclosed.Text + ",'" + cmbcancel.SelectedValue + "',curdate(),'" + userid + "',0)";
         objcls.exeNonQuery(dh);
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         gridbind();
     }
 }
Exemplo n.º 13
0
 protected void Button3_Click(object sender, EventArgs e)
 {
     if (txtdate.Text == "" && txtperiod.Text == "" && cmbUrgency.SelectedValue == "-1" && cmbPolicy.SelectedValue == "-1")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowRequired();", true);
     }
     else
     {
         string date = datenew();
         con = objcls.NewConnection();
         int pk = 0;
         pk = objcls.PK_exeSaclarInt("id", "t_policy_housekeep");
         pk = pk + 1;
         if (con.State == ConnectionState.Closed)
         {
             con.ConnectionString = strConnection;
             con.Open();
         }
         OdbcCommand cmd = new OdbcCommand("insert into t_policy_housekeep(id,level,fromdate,todate,time,policy,createdby,createdon,updatedby,updatedon,rowstatus)values(" + pk + "," + cmbUrgency.SelectedValue + ",'" + objcls.yearmonthdate(txtdate.Text) + "','9999-12-30','" + txtperiod.Text + "'," + cmbPolicy.SelectedValue + ",'" + userid + "','" + date + "','" + userid + "','" + date + "',0)", con);
         int         i   = cmd.ExecuteNonQuery();
         if (i == 1)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
         }
         int pknew;
         pknew = pk - 1;
         OdbcCommand cmddate = new OdbcCommand("update  t_policy_housekeep set todate='" + objcls.yearmonthdate(txtdate.Text) + "' where id=" + pknew, con);
         cmddate.ExecuteNonQuery();
         gridbind();
     }
     //else
     //{
     //    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowValue();", true);
     //}
 }
Exemplo n.º 14
0
    //public string yearmonth(string s)
    //{
    //    #region YYYY/MM/DD


    //    if (s != "")
    //    {
    //        // date

    //        if (s[2] == '-' || s[2] == '/')
    //        {
    //            d = s.Substring(0, 2).ToString();
    //        }
    //        else if (s[1] == '-' || s[1] == '/')
    //        {
    //            d = s.Substring(0, 1).ToString();
    //        }
    //        else
    //        {

    //        }


    //        // month  && year


    //        if (s[5] == '-' || s[5] == '/')
    //        {
    //            m = s.Substring(3, 2).ToString();


    //            //year

    //            if (s.Length >= 9)
    //            {
    //                y = s.Substring(6, 4).ToString();
    //            }
    //            else if (s.Length < 9)
    //            {
    //                y = "20" + s.Substring(6, 2).ToString();
    //            }
    //            else
    //            {

    //            }

    //            ///year

    //        }
    //        else if (s[4] == '-' || s[4] == '/')
    //        {
    //            //year

    //            if (s.Length >= 8)
    //            {
    //                y = s.Substring(5, 4).ToString();
    //            }
    //            else if (s.Length < 8)
    //            {
    //                y = "20" + s.Substring(5, 2).ToString();
    //            }
    //            else
    //            {

    //            }

    //            //year


    //            if (s[1] == '-' || s[1] == '/')
    //            {
    //                m = s.Substring(2, 2).ToString();
    //            }
    //            else if (s[2] == '-' || s[2] == '/')
    //            {
    //                m = s.Substring(3, 1).ToString();
    //            }
    //            else
    //            {

    //            }
    //        }
    //        else if (s[3] == '-' || s[3] == '/')
    //        {
    //            if (s[1] == '-' || s[1] == '/')
    //            {
    //                m = s.Substring(2, 1).ToString();
    //            }

    //            //year



    //            if (s.Length >= 7)
    //            {
    //                y = s.Substring(4, 4).ToString();
    //            }
    //            else if (s.Length < 7)
    //            {
    //                y = "20" + s.Substring(4, 2).ToString();
    //            }
    //            else
    //            {

    //            }



    //        }

    //        g = y.ToString() + '-' + m.ToString() + '-' + d.ToString();

    //    }
    //    else
    //    {
    //        g = "";
    //    }
    //    return (g);


    //    #endregion
    //}
    #endregion

    #region RETURN NOTE
    protected void lnkReturnNote_Click(object sender, EventArgs e)
    {
        conn = obje.NewConnection();
        DateTime Cur;

        Cur = DateTime.Now;
        string Cur1 = Cur.ToString("yyyy/MM/dd");
        string Tim  = Cur.ToString("hh:mm tt");
        string Dat  = Cur.ToString("dd MMM");

        if (txtFromDate.Text != "")
        {
            FD = obje.yearmonthdate(txtFromDate.Text);
        }

        OdbcCommand LnReturn = new OdbcCommand("CALL selectcond(?,?,?)", conn);

        LnReturn.CommandType = CommandType.StoredProcedure;
        LnReturn.Parameters.AddWithValue("tblname", "t_material_retrun m,t_material_return_items mi,m_inventory inv,m_sub_item i,m_sub_store s,m_sub_unit u");
        LnReturn.Parameters.AddWithValue("attribute", "itemname,itemcode,storename,sum(return_qty) as return_qty,m.retno,unitname");
        if (txtFromDate.Text != "")
        {
            LnReturn.Parameters.AddWithValue("conditionv", "mi.item_id=i.item_id and mi.item_id=inv.item_id and m.returnedto=s.store_id and m.retno=mi.retno "
                                             + "and date(returnedon) = '" + FD + "' and u.unit_id=inv.unit_id group by mi.item_id,m.returnedto");
        }
        else if (txtFromDate.Text == "")
        {
            LnReturn.Parameters.AddWithValue("conditionv", "mi.item_id=i.item_id and mi.item_id=inv.item_id and m.returnedto=s.store_id and m.retno=mi.retno and u.unit_id=inv.unit_id group by mi.item_id,m.returnedto");
        }
        OdbcDataAdapter ReturnDat = new OdbcDataAdapter(LnReturn);
        DataTable       dt        = new DataTable();

        ReturnDat.Fill(dt);
        if (dt.Rows.Count == 0)
        {
            lblOk.Text       = "No Details found"; lblHead.Text = "Tsunami ARMS - Warning";
            pnlOk.Visible    = true;
            pnlYesNo.Visible = false;
            ModalPopupExtender2.Show();
            return;
        }

        OdbcCommand Malayalam = new OdbcCommand("select seasonname from m_season s,m_sub_season d where curdate()>=startdate and curdate()<=enddate and "
                                                + " s.rowstatus<>'2' and s.season_sub_id=d.season_sub_id and d.rowstatus<>'2' and s.is_current='1'", conn);
        OdbcDataReader Malr = Malayalam.ExecuteReader();

        if (Malr.Read())
        {
            Season = Malr[0].ToString();
        }

        DateTime gh       = DateTime.Now;
        string   transtim = gh.ToString("dd-MM-yyyy hh-mm tt");
        string   ch       = "Returned Items Details" + transtim.ToString() + ".pdf";

        Document doc         = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 50);
        string   pdfFilePath = Server.MapPath(".") + "/pdf/" + ch;
        Font     font9       = FontFactory.GetFont("ARIAL", 9);
        Font     font8       = FontFactory.GetFont("ARIAL", 9, 1);
        Font     font10      = FontFactory.GetFont("ARIAL", 12, 1);
        Font     font11      = FontFactory.GetFont("ARIAL", 10, 1);
        pdfPage  page        = new pdfPage();

        page.strRptMode = "Blocked Room";
        PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream(pdfFilePath, FileMode.Create));

        wr.PageEvent = page;
        doc.Open();
        PdfPTable table2 = new PdfPTable(8);

        table2.TotalWidth  = 550f;
        table2.LockedWidth = true;
        float[] colwidth1 = { 2, 5, 3, 4, 6, 3, 5, 3 };
        table2.SetWidths(colwidth1);

        PdfPCell cell = new PdfPCell(new Phrase("Material Return Note   ", font10));

        cell.Colspan             = 8;
        cell.Border              = 1;
        cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
        table2.AddCell(cell);

        PdfPCell cella = new PdfPCell(new Phrase("Season Name :  " + Season, font11));

        cella.Colspan             = 4;
        cella.Border              = 0;
        cella.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
        table2.AddCell(cella);
        PdfPCell cellb = new PdfPCell(new Phrase("Date :  " + Dat, font11));

        cellb.Colspan             = 4;
        cellb.Border              = 0;
        cellb.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
        table2.AddCell(cellb);

        PdfPCell cell5a = new PdfPCell(new Phrase(new Chunk("No", font8)));

        table2.AddCell(cell5a);

        PdfPCell cell6a = new PdfPCell(new Phrase(new Chunk("Item Name", font8)));

        table2.AddCell(cell6a);

        PdfPCell cell8a = new PdfPCell(new Phrase(new Chunk("Code", font8)));

        table2.AddCell(cell8a);

        PdfPCell cell8b = new PdfPCell(new Phrase(new Chunk("UOM", font8)));

        table2.AddCell(cell8b);

        PdfPCell cell8p = new PdfPCell(new Phrase(new Chunk("Ret Office", font8)));

        table2.AddCell(cell8p);

        PdfPCell cell8y = new PdfPCell(new Phrase(new Chunk("Ret Qty", font8)));

        table2.AddCell(cell8y);

        PdfPCell cell10k = new PdfPCell(new Phrase(new Chunk("Ret No", font8)));

        table2.AddCell(cell10k);
        PdfPCell cell10p = new PdfPCell(new Phrase(new Chunk("Remark", font8)));

        table2.AddCell(cell10p);
        doc.Add(table2);
        int slno = 0; int i = 0;

        foreach (DataRow dr in dt.Rows)
        {
            slno = slno + 1;
            if (i > 35)
            {
                i = 0;
                doc.NewPage();
                PdfPTable table1 = new PdfPTable(8);
                table1.TotalWidth  = 550f;
                table1.LockedWidth = true;
                float[] colwidth2 = { 2, 5, 3, 4, 6, 3, 5, 3 };
                table1.SetWidths(colwidth2);
                PdfPCell cell5ab = new PdfPCell(new Phrase(new Chunk("No", font8)));
                table1.AddCell(cell5ab);

                PdfPCell cell6ab = new PdfPCell(new Phrase(new Chunk("Item Name", font8)));
                table1.AddCell(cell6ab);

                PdfPCell cell8ab = new PdfPCell(new Phrase(new Chunk("Code", font8)));
                table1.AddCell(cell8ab);

                PdfPCell cell8bb = new PdfPCell(new Phrase(new Chunk("UOM", font8)));
                table1.AddCell(cell8bb);

                PdfPCell cell8pb = new PdfPCell(new Phrase(new Chunk("Ret Office", font8)));
                table1.AddCell(cell8pb);

                PdfPCell cell8yb = new PdfPCell(new Phrase(new Chunk("Ret Qty", font8)));
                table1.AddCell(cell8yb);

                PdfPCell cell10kb = new PdfPCell(new Phrase(new Chunk("Ret No", font8)));
                table1.AddCell(cell10kb);
                PdfPCell cell10pb = new PdfPCell(new Phrase(new Chunk("Remark", font8)));
                table1.AddCell(cell10pb);
                doc.Add(table1);
            }
            PdfPTable table = new PdfPTable(8);
            table.TotalWidth  = 550f;
            table.LockedWidth = true;
            float[] colwidth3 = { 2, 5, 3, 4, 6, 3, 5, 3 };
            table.SetWidths(colwidth3);

            PdfPCell cell11 = new PdfPCell(new Phrase(new Chunk(slno.ToString(), font9)));
            table.AddCell(cell11);
            string   itn    = dr["itemname"].ToString();
            PdfPCell cell12 = new PdfPCell(new Phrase(new Chunk(itn.ToString(), font9)));
            table.AddCell(cell12);
            string   ic     = dr["itemcode"].ToString();
            PdfPCell cell14 = new PdfPCell(new Phrase(new Chunk(ic.ToString(), font9)));
            table.AddCell(cell14);
            string   un     = dr["unitname"].ToString();
            PdfPCell cell15 = new PdfPCell(new Phrase(new Chunk(un.ToString(), font9)));
            table.AddCell(cell15);
            PdfPCell cell16 = new PdfPCell(new Phrase(new Chunk(dr["storename"].ToString(), font9)));
            table.AddCell(cell16);
            PdfPCell cell17 = new PdfPCell(new Phrase(new Chunk(dr["return_qty"].ToString(), font9)));
            table.AddCell(cell17);
            PdfPCell cell18 = new PdfPCell(new Phrase(new Chunk(dr["retno"].ToString(), font9)));
            table.AddCell(cell18);
            PdfPCell cell18a = new PdfPCell(new Phrase(new Chunk("", font9)));
            table.AddCell(cell18a);
            i++;
            doc.Add(table);
        }

        PdfPTable table5 = new PdfPTable(3);
        PdfPCell  cellab = new PdfPCell(new Phrase(new Chunk(" ", font9)));

        cellab.Border = 1;
        table5.AddCell(cellab);
        PdfPCell cellac = new PdfPCell(new Phrase(new Chunk(" ", font9)));

        cellac.Border = 1;
        table5.AddCell(cellac);
        PdfPCell cellav = new PdfPCell(new Phrase(new Chunk(" ", font9)));

        cellav.Border = 1;
        table5.AddCell(cellav);

        PdfPCell cellaq = new PdfPCell(new Phrase(new Chunk("Item returned by", font8)));

        cellaq.Border = 0;
        table5.AddCell(cellaq);
        PdfPCell cellaw = new PdfPCell(new Phrase(new Chunk("Accepted by", font8)));

        cellaw.Border = 0;
        table5.AddCell(cellaw);
        PdfPCell cellae = new PdfPCell(new Phrase(new Chunk("Approved by", font8)));

        cellae.Border = 0;
        table5.AddCell(cellae);
        doc.Add(table5);
        doc.Close();
        Random r = new Random();
        string PopUpWindowPage = "print.aspx?reportname=" + ch.ToString() + "&Title=Returned Item Details";
        string Script          = "";

        Script += "<script id='PopupWindow'>";
        Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + r.Next() + "','scrollbars=yes,resizable=1,width=1350,height=680,left=0,top=0,status');";
        Script += "confirmWin.Setfocus()</script>";
        if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
        {
            Page.RegisterClientScriptBlock("PopupWindow", Script);
        }

        conn.Close();
    }